Local Cache is the only cache available in developer edition of NCache, but remote clients for local cache are not supported in this edition.
NCache supports a standalone non-clustered cache which resides on a single node. Local cache is similar in features with 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, so 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. Local cache is suitable for applications having a small number of clients with low activity or where applications don't need to cache large amount of data.
A local cache has two isolation levels:
- InProc (In-process)
This isolation level means that cache resides inside the memory space of client application. As this type of cache exists inside the application process, so 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, memory limitations can be faced 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 .NET framework.
Although objects are not kept in serialized form in 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 it is needed.
- OutProc (Out-of-process)
This isolation level means that cache resides in a separate process (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 communication cost outside the process.
OutProc local cache is suitable for situations when multiple clients application needs to access the same cached data. For example, in a web garden where each ASP.NET application runs in a separate worker process, OutProc cache should be used. Also in ASP.NET applications, using an InProc cache instance is not considered as the best option due to process memory limitation. However, note that there will be an overhead of transferring data between application process and the cache itself.