-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Feature Request
I would like the ability to set the TTL on values in a KV individually AND have the ability to UPDATE that TTL at any time.
I currently use Redis to do exactly this.
Scenario:
Calculating user Profiles is expensive and requires composing data from several source, including 3rd party API's so I cache them to avoid composition as often as possible.
If the Profile is not in the cache I compose the profile then store in cache (expensive)
I store the users profile in a KV with a TTL of 10 minutes, usual user engagement in the app is around 5-8 minutes depending on which features the user is engaged with.
I use the TTL to keep the cache clean, I do not need thousands of inactive user profiles in the cache consuming memory if the user has not interacted with the app for a while.
However, every time I GET the profile from the KV cache I also want to RESET the TTL to be 10 minutes from now, overwriting the TTL stops the eviction if the user spends more time engaged.
Possible options:
- Add a TTL parameter on getting a key from the KV that resets the TTL to this new value (ATOMIC request) - preferred
- Seperate set TTL method for a key - acceptable