#CacheModule / Which ttl will be used?
4 messages · Page 1 of 1 (latest)
Yeah, I wondered this too....
In my case I have an persistent cache that needs manual eviction ( for some endpoints ), valkey and a valkey memory cache.
Fallback cache documentation isn't very comprehensive.
Seems like it would set primary to 1h and secondary to 3h https://github.com/jaredwray/cacheable/tree/main/packages/cacheable#storage-tiering-and-caching
Just to be clear, the cache-manager is a different package than cacheable and has no real clue about primary or secondary cache. The first cache in the stores array is considered the default for use with the cache interceptor. Otherwise, you have to inject the cache manager and use your own logic to use each cache individually, as you need them. It seems, the only way to get a particular store is via the stores array.
The ttl property is a default or rather should be considered the max ttl. If you add a ttl to the store that is shorter, then that overrides the default ttl. If you add an even shorter ttl to the set command, that overrides all of them. I've not tested the "max ttl", so it is theory on my part. But, for sure there should be overrides and for sure you should be thinking of the default as a maximum.