The image creating the Spring service is as follows:
+ -------- + + --------- + + --------- +
| Backend | --------- | My | ----------- | Clients |
| service | | service | | |
+ -------- + + --------- + + --------- +
In order not to make too many requests for the backend, I use Ehcache. Imagine that my service is a sports portal, and I cache the results so that when the client requests them, I return the cache, if there is no cache, I take information from the backend, put it in the cache, and then return it to the client.
Now, if I have these options, set
long timeToLiveSeconds long timeToIdleSeconds
and clients make requests too often, timeToIdleSeconds will not expire, but timeToLiveSeconds will expire anyway, and the item will be deleted from the cache in which I put it, right?
source share