CachingCallHandler of the enterprise library caches items using NoAbsoluteExpiration. But, I don’t see a way to invalidate the cache. That one would want an item cached forever with no way to invalidate it, doesn’t make any sense.
Before I implement my own invalidation method, I wanted to validate that there doesn’t exist a trivial invalidation mechanism that I’m not aware of?
Update:
It looks like this is not built in. But, I think it is using the gethashcode for the key. I can probably thus remove the key for invalidation.
I am still trying to figure out why one would want sliding expiration. Of course, if one could tie the expiration to the database or a file updating with invalidation then it could be ideal. Yet, without such advanced mechanisms for cache invalidation, it seems pointless.
You wrote:
But as you mention later, it is actually a sliding expiration so the items are eventually removed from the cache if they are not accessed within a certain period of time.
Unfortunately, the
CachingCallHandleronly uses a sliding expiration:Here’s what it does in code:
As for what the point of this approach is, it does seem to be a bit limited. However, it does address the scenario where you have fairly static data that doesn’t need to be refreshed on demand.
Note that the CachingCallHandler has been removed from Enterprise Library 5.0 due to “un-resolvable security vulnerabilities” so you may not want to use this feature.