Update expire time for specific entrys
What I need is to add expire time for specific keys. Currently cacheout provides api "set" to create new entry or update existing entry. So a simple way is:
v = cache.get(k, None)
if v is not None:
cache.set(k, v, ttl=100)
else:
raise KeyError(k)
Will you consider to provide apis like "expire" in Redis to update expire time directly?
Having redis "expire" functionality would be fine to add. Were there other "expire" functions you had in mind?
The expire function should support update expire time when ttl is specified, and also support to move the key to the end of the cache stack when ttl is not specified, which means it would be evicted last. Since similar method like "evict", "expired", "expire_times" are already named, I suggest to use name "update".