Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Caching in WCF?

Tags:

c#

.net

wcf

I am building a WCF service. I need to store reference data in the cache which I will look up every time I receive input from the method... What is the right way to do this? I would also like to define an expiration policy for the cache that will invalidate it after a certain time interval.

like image 440
Developer Avatar asked May 28 '09 17:05

Developer


People also ask

What is caching & types of caching?

Caching is a mechanism to improve the performance of any type of application. Technically, caching is the process of storing and accessing data from a cache. But wait, what is a cache? A cache is a software or hardware component aimed at storing data so that future requests for the same data can be served faster.

What is caching in C#?

Caching enables you to store data in memory for rapid access. When the data is accessed again, applications can get the data from the cache instead of retrieving it from the original source. This can improve performance and scalability.

What is caching and why is it important?

A cache's primary purpose is to increase data retrieval performance by reducing the need to access the underlying slower storage layer. Trading off capacity for speed, a cache typically stores a subset of data transiently, in contrast to databases whose data is usually complete and durable.

What is caching in ASP.NET web API?

Caching is the technique of storing the data which are frequently used. Those data can be served faster for any future or subsequent requests by eliminating the unnecessary requests to external data sources.


1 Answers

If you are using .NET 4, the recommended way is to use MemoryCache

like image 74
Juozas Kontvainis Avatar answered Oct 08 '22 13:10

Juozas Kontvainis