开发者

Cache frameworks for .NET

I'm planning to develop a web service, i need to use in memory cache, what different caching frameworks are available out there for .NET, i have used Microsoft Enterprise Library Cache block and also evaluated NCache for distributed environment.

My core requirement is reliability with Cached data, i was thinking开发者_开发百科 of using Enterprise Lib Cache block DB data store for persistence in case worker process get restarted.

Any options??


You can checkout GigaSpaces XAP.NET which is a fully distributed and transaction in memory data grid which can serve as a cache among many other things. It can also be your actual application server which allows you to deploy your application in distributed fashion along with the distributed cache. It is highly available, self healing and self managing grid, which you can scale out and in on demand.

Disclaimer - I work for GigaSpaces.


Your cache is a volatile data store, you should write your software so that it EXPECTS that the cache is unavailable. e.g.

public DtoThing GetSomeData(string parameters)
{
   if (<check cache for data> == <not there>)
     return <get data from persistent store>
   else
     return <get data from cache>
}

If you use a database as a backing store for the cache, you've basically just traded away all the benefits of using a cache. When you say the cache needs to be reliable, are you saying that the updates need to be consistent or that the data needs to always be in the cache? If the former, it's easy to make sure that happens as long as you write your software in such a way that there is only ever one path to update the data, and then that path can invalidate the cache upon successfully performing its write to the persistent data store.


I have experience using Microsoft's Enterprise Library Cache Block and it worked fine for me. The EntLib configuration can be a bit verbose at times but it gets the job done. Is there a particular reason you are looking for something else?


A couple come to mind:

1) Memcached

2) Enterprise Library Caching Application Block


There are plenty of potential solutions for this type of question. You mentioned looking at NCache; if you have time, check out Oracle Coherence, which is the product that NCache attempted to copy ;-)

My suggestion, though, is that unless you need the benefits of a distributed cache, that it's a lot simpler to just use a single-process, in-memory cache.

And just in case you're curious, one early discussion of NCache's origins: http://www.theserverside.com/news/thread.tss?thread_id=43950

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜