I am looking for some confirmation on how to store, update and expire data held in catbox.
We attempt a get on the cache, if the data doesn't exist we make a service call receive data and add to cache using set with a ttl, all new requests are served from cache until ttl expires, once it expires the data is automatically removed from cache and we make service call again to update.
With this approach the following issue can occur, service call fails or responds with bad data, the cache has expired and there is no longer an element in cache so now we are left in a situation without any data to serve.
How can I expire data in the cache (make it stale) but still have it served as a fallback if I fail to complete the service call to refresh - is this possible?
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
I am looking for some confirmation on how to store, update and expire data held in catbox.
We attempt a
get
on the cache, if the data doesn't exist we make a service call receive data and add to cache usingset
with attl
, all new requests are served from cache untilttl
expires, once it expires the data is automatically removed from cache and we make service call again to update.With this approach the following issue can occur, service call fails or responds with bad data, the cache has expired and there is no longer an element in cache so now we are left in a situation without any data to serve.
How can I expire data in the cache (make it stale) but still have it served as a fallback if I fail to complete the service call to refresh - is this possible?
Thanks