如何在一段时间后删除 .txt 文件? [英] How to delete a .txt file after a certain time?

查看:50
本文介绍了如何在一段时间后删除 .txt 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个显示信息的 .txt 文件,但我想在大约 5 分钟后删除它自己.

I have this .txt file that displays information but I want to delete itself after like 5 minutes or so.

推荐答案

考虑到您正在做什么,使用 memcached 不是更好的选择吗?您只需将您的 ips 作为键=值对存储在 memcached 中,有效期为 5 分钟.因此,您的数据总是每 5 分钟过期一次.与 memcached 的交互也比文件处理容易得多.

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.

这篇关于如何在一段时间后删除 .txt 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆