Automatic TTL refresh
Opened this issue · 0 comments
ymwjbxxq commented
Hello,
I have noticed the with_refresh_on_update
applied only to the collection.
I would suggest to extend to the set and get:
let mut momento = SimpleCacheClientBuilder::new(credential_provider, Duration::from_secs(30))?
.build();
momento.set(&cache_name, "key1", "I need ttl refresh", None)
.with_compression()
.with_automatic_refresh()
.await?;
momento.get(&cache_name, "key1")
.with_compression()
.with_automatic_refresh()
.await?;
momento.set(&cache_name, "key2", "just a standard let me expire", None)
.await?;
momento.get(&cache_name, "key2")
.await?;
WHY:
Sometimes, a value must be kept in the cache until it is used. However, rather than setting a Time To Live (TTL) of 30 days or more, I prefer to keep it short and renew the TTL automatically.
Currently:
I am required to reset the existing value by using a new SET with a new TTL.