What I mean is some kind of event or callback that gets called when some cached value ends. Presumably, this currenlty caching value should be assigned to this callback, for example, to store it somewhere else besides caching.
To find such a way, I looked at the Notifications option , but they look as if they are applicable for explicit cache actions, such as adding or removing, while expiration is something that happens implicitly. I found that none of these callbacks were called many minutes after the cache expired and became null, while it is usually called within the polling interval if I call DataCache.Removeexplicitly (incorrectly, see Update below).
I find this behavior strange since ASP.Net has such a callback. You can even find an explanation of how to use it here on SO .
In addition, I have tried DataCache Events . On MSDN, it cuts literally
This API supports the .NET Framework and is not intended to be used directly from your code.
However, I created a handler for this event to check if I could check its arguments as CacheOperationStartedEventArgs.OperationType == CacheOperationType.ClearCache, but it seemed in vain.
At the moment, I started thinking of workarounds for this problem due to the lack of the required callback. Therefore, suggestions on how to implement them are also welcome.
UPDATE After more careful and patient testing, I found out that a notification is DataCacheOperations.ReplaceItemsent after the expiration date. Unfortunately, I did not find a way to get the value that was cached before the expiration date.
source
share