I heard that .NET 4 has a new caching API.
Okay, so the good old System.Web.Caching.Cache
(which is, by the way, still there in .NET 4) has the ability to set so-called CacheDependency
objects to determine whether a cached item is expired or not.
One can also specify custom logic for determining whether a cached item is still useable or not by deriving a custom subclass from CacheDependency
.
I'm curious, is there a way to provide such a logic in the new API?
Runtime caching refers to gradually adding responses to a cache "as you go". While runtime caching doesn't help with the reliability of the current request, it can help make future requests for the same URL more reliable.
Note that the MemoryCache is a singleton, but within the process. It is not (yet) a DistributedCache. Also note that Caching is Complex(tm) and that thousands of pages have been written about caching by smart people.
Cache dependencies allow the application to automatically clear cached data when related objects are modified. The system uses dummy cache keys to create dependencies between cached data and other objects. Dummy keys are cache items without any data that represent objects or groups of objects.
I haven't really used it yet but classes derived from ChangeMonitor Class appear to serve a similar purpose.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With