tags:

views:

48

answers:

2

Hi I'm using the following code to cache objects.

HttpRuntime.Cache.Insert("Doc001", _document); HttpRuntime.Cache.Remove("Doc001");

I would like to know were the cache is stored? (On the client PC or the IIS server)

Is this a save way of cache objects and by adding and removing cache in this way will it influence any of the other clients, say for instance i've got 2 clients connected and both are storing cache "*HttpRuntime.Cache.Insert("Doc001", _document);*" and one client removes the cache, is it only removed on a client level?

A: 

This will depend where you are writing this code. If you are doing it in the WCF service then objects will be stored in the memory of the process hosting this service (if IIS then w3p.exe). The cache will be shared among all clients of the service meaning that if a client removes an item from the cache other clients will see it removed as well.

An important thing to know when using this construct is that the runtime might decide to expire objects from the cache in certain circumstances (for example running on low memory), so always check for the presence of the object in the cache before using it: don't assume that if you put it there you will find it later.

You may read more about caching on MSDN.

Darin Dimitrov
I want to cache on a client level, what will I use?
francois
A: 

The caching takes place in the Website (MVC).

francois