Cache policies expiry time query

Hi guys, can we set a Cache which will never expire?

I thought the below config would never expire the cache, but it is caching for only a few minutes,

<ExpirySettings>
        <ExpiryDate/>
        <TimeOfDay/>
        <TimeoutInSec>-1</TimeoutInSec>
</ExpirySettings>

I am specifically looking for ResponseCache Policy, would also like to know about other cache policies and KVM cache expiry settings as well.

This is just a query and not for any practical use case.

Solved Solved
0 2 336
1 ACCEPTED SOLUTION

No, I don't believe it is possible to store an item in cache "forever". That makes sense if you think about it , a cache is not a persistent store. For that use the KVM, or custom attributes on an entity, or some other, maybe external persistent store.

For the ExpirySettings values, If you insert -1 for TimeoutInSec (actually any value less than zero) and save the policy configuration, then the policy execution will use a default value for TTL. You are observing that the default TTL is "only a few minutes". We haven't documented the default value; that seems like a documentation bug. Ref: b/136473188

View solution in original post

2 REPLIES 2

No, I don't believe it is possible to store an item in cache "forever". That makes sense if you think about it , a cache is not a persistent store. For that use the KVM, or custom attributes on an entity, or some other, maybe external persistent store.

For the ExpirySettings values, If you insert -1 for TimeoutInSec (actually any value less than zero) and save the policy configuration, then the policy execution will use a default value for TTL. You are observing that the default TTL is "only a few minutes". We haven't documented the default value; that seems like a documentation bug. Ref: b/136473188

Thanks for the info!