Does cache renew expiration time when I get value from it?

Not applicable

Does cache renew expiration time when I get value from it?

Solved Solved
0 3 339
1 ACCEPTED SOLUTION

sarthak
Participant V

@Oleksandr Skoryi Cache expiry is set at a generic level where you are defining cache to expire every x amount of time.That time won't change based on when you retrieve that element from cache.

If you want to it then there may be a workaround:

Everytime an element is retrieved from cache invoke "Invalidate cache policy" and expire that particular element and repopulate the cache using "populate cache policy".

I havn't tried this myself, but it should work.

View solution in original post

3 REPLIES 3

sarthak
Participant V

@Oleksandr Skoryi Cache expiry is set at a generic level where you are defining cache to expire every x amount of time.That time won't change based on when you retrieve that element from cache.

If you want to it then there may be a workaround:

Everytime an element is retrieved from cache invoke "Invalidate cache policy" and expire that particular element and repopulate the cache using "populate cache policy".

I havn't tried this myself, but it should work.

completely right, it works. its the only way as far as I know nowadays

Hi @Oleksandr Skoryi,

cache expiry time is set when cache is populated and does not change with cache retrieval.

You can also dynamically set the cache expiry time. For details you can refer populate cache policy and response-cache-policy