You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Im trying to implement a delayed queue. I was thinking I could maybe add items into the cache with a ttl, and before expiration get a pre-expire or pre-evict callback to do what I need to do with the items. It doesn't appear like this is supported. Any ideas?
The text was updated successfully, but these errors were encountered:
Yeah, unfortunately, that's not supported for the current adapters, it is very specific and also depends on the cache and adapter implementation. There might be caches that give you that information via events (subscriptions), and normally they tell you when a key expires, but not X period of time before it expires. So, for this specific use case you have to implement something at the application level. For example, using a pre-hook, you can pattern-match the gets with the key you want, and check if that key is gonna expire soon or not and then apply your custom logic, but of course, it is a logic that will be performed every time you do a get. For more info, you can check this section about pre/post hooks.
On the other hand, do you want the "pre-expire hook or event" for all cached keys? If so, that could be a problem, imagine millions of keys across multiple nodes, it will generate significant traffic and maybe a bottleneck too, again, depending on the number of events the cache has to propagate across the network to different subscribers (it is something to consider too). Or you have a specific use case where you are interested in only a few/specific keys? If this is the case, that can be addressed easier.
Im trying to implement a delayed queue. I was thinking I could maybe add items into the cache with a ttl, and before expiration get a pre-expire or pre-evict callback to do what I need to do with the items. It doesn't appear like this is supported. Any ideas?
The text was updated successfully, but these errors were encountered: