0

I'm trying to find a product like Varnish that can give me the possibility to handle grafecul invalidation on cache, which basically is the ability to guarantee cache time to the client because when a key value is invalid or expired, isn not the client itself to get the content from the origin having to wait a long time, but it's always the cache system which do it for the client separately, in the meantime the client only gets the cache content even if it's invalid.

Example of the scenarios:

Scenario where the cache value is valid.

1) Client -> cache valid -> cached object

Scenario where the cache value is invalid.

1) Client -> cache invalid -> old cache object

2) Caching system -> origin -> replace old cache object

is there any way to do this prefetch ensuring the client a cache response time with Redis?

1 Answers1

0

You need to handle how you are invalidating a key-value. After that:

Scenario where the cache value is invalid.

1) Client -> cache invalid -> old cache object

2) Caching system -> origin -> replace old cache object

If you already know that the key is invalid/expired then Redis has an option to get previous and set the new value to cache. GETSET key value

Example:

redis> SET mykey "Hello"
"OK"
redis> GETSET mykey "World"
"Hello"
redis> GET mykey
"World"
redis>
MD Ruhul Amin
  • 4,386
  • 1
  • 22
  • 37