Cache Framework for .NET.

I plan to develop a web service, I need to use in the memory cache which various caching frameworks are available for .NET, I used the Cache block for Microsoft Library, and also rated NCache for a distributed environment.

My main requirement is reliability with Cached data, I thought about using the DB data store of the Enterprise Lib data block to save in case of restarting the workflow.

Any options

+4
source share
5 answers

Your cache is a volatile data storage, you must write your software so that it EXPECTs that the cache is unavailable. eg.

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 the database as a backup storage for the cache, you basically just get rid of all the benefits of using the cache. When you say that the cache should be reliable, do you say that the updates should be consistent or that the data should always be in the cache? If the first, it’s easy to make sure that this happens as long as you write your software in such a way that there is only one way to update the data, and then this way can lead to invalidation of the cache if it was successfully written to the permanent data store.

+4
source

You can check out GigaSpaces XAP.NET , which is a fully distributed and transactional data memory grid that 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 a distributed form along with a distributed cache. This is a highly accessible, self-healing, and self-contained grid that you can scale on demand.

Disclaimer - I work for GigaSpaces.

+5
source

I have experience with the Cache block for the Microsoft Enterprise library, and it works great for me. EntLib configuration can sometimes be a bit verbose, but it does the job. Is there any specific reason you are looking for something else?

+3
source
+1
source

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

My suggestion is that if you do not need the benefits of a distributed cache, it is much easier to just use a single-processor cache in memory.

And just in case you are interested, one early discussion of the origin of NCache: http://www.theserverside.com/news/thread.tss?thread_id=43950

0
source

Source: https://habr.com/ru/post/1303142/


All Articles