Local Cache is the only cache available in the developer installation of NCache, but it does not support remote clients for local cache.
NCache supports a standalone non-clustered cache that resides on a single node. The Local cache is similar in features to the other clustered caches, i.e., it has all the caching features provided in any other caching topology, but it is not scalable or fault-tolerant like clustered caches. As it is a single server cache, its transactional capacity can’t be increased by adding multiple servers. Also, it creates a single cache instance (no backup or replica), thus, if it goes down, all cached data is lost. A Local cache is suitable for applications with a small number of clients with low activity or where applications don't need to cache large amounts of data.
A local cache has two isolation levels as follows:
This isolation level means that the cache resides inside the memory space of the client application. As this type of cache exists inside the application process, the response time is faster. In InProc, NCache keeps cached data as live objects (not in serialized form) which reduces the serialization/de-serialization cost. However, such applications may face memory limitations, since application and cache share the same memory. Also, cached data in this case can’t be shared with applications running outside this process.
Since objects are stored in the same address space as the cache client, cache clients get the reference to cached objects instead of a copy. For multithreaded applications, where multiple threads are modifying the same object, these changes need to be synchronized using various synchronization techniques available in the .NET framework.
Although objects are not kept in a serialized form in the InProc caches, it is
still required to have all objects marked as
calculates the size of an object by serializing the objects which later
helps in eviction when needed.
This isolation level means that the cache resides in a separate process (the NCache service process) from the client application. Multiple clients (local and remote) can connect to the same cache to share data. Latency, in this case, is more than InProc cache, because of the communication cost outside the process.
The OutProc local cache is suitable for situations when multiple clients in the application need to access the same cached data. For example, in a web garden where each ASP.NET application runs in a separate worker process, an OutProc cache should be used. Also, in ASP.NET applications, using an InProc cache instance is not considered the best option due to process memory limitations. However, note that there will be an overhead of transferring data between the application process and the cache itself.