Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there some sort of CacheDependency in System.Runtime.Caching?

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?

like image 348
Venemo Avatar asked May 22 '10 21:05

Venemo


People also ask

What is runtime caching?

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.

Is MemoryCache a singleton?

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.

What is cache dependency?

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.


1 Answers

I haven't really used it yet but classes derived from ChangeMonitor Class appear to serve a similar purpose.

like image 83
Ben Robinson Avatar answered Sep 24 '22 10:09

Ben Robinson