问题
I have this .txt file that displays information but I want to delete itself after like 5 minutes or so.
回答1:
Considering what you are doing, won't using memcached be a better option? You just store your ips as key=value pairs in memcached, with an expiry of 5 minutes. Thus your data always expires every 5 minutes. Also interaction with memcached is much easier than file-handling.
来源:https://stackoverflow.com/questions/32173259/how-to-delete-a-txt-file-after-a-certain-time