问题
Is there anyway to create a Redis database where keys HAVE TO expire after a certain time? I know I can expire an individual key using the EXPIRE
command but since I am expiring every key after a certain time anyways, it would be nice to have this behavior specified in the Redis config file.
回答1:
No, Redis (up to and including v3.2) does not provide the means for automatically setting the TTL of newly-created keys. You have to set it explicitly for each key you create.
来源:https://stackoverflow.com/questions/37121373/redis-database-ttl