Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Is it possible to serve stale data from Redis by design?

$
0
0

I have a Java application that is responsible for serving up various (sometimes large) json responses to client applications. At the app layer, it uses Redis (AWS ElastiCache) to cache the json with TTLs from 30s to 5min depending on the particular request. Some of the requests a rather long-running (5-15s), reaching out to several external services and returning a large amount of data. If the TTL is 60s, that still means that some users are getting unacceptable response times every minute. Instead of immediately evicting the data from the cache when the TTL is up, I'd like to kick off a background task to fetch the data and refresh the cache, while continuing to serve a stale copy of the data if it exists. Is this possible with Redis?


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>