Windows Server AppFabric allows cache clients (as long as they are authorized) to access and modify the cache concurrently. Concurrent cache read-access works just fine and the cache cluster (scale-out) generally helps with demands on the scalability. However, the real challenge is to handle concurrent writes to the cache.
Note
To understand concurrency issues, consider a scenario where we have two cache clients, let's call them client A and client B. Let us assume that client A and client B both have copies of the same data (retrieved against the same key from Windows Server AppFabric Cache). Imagine that client A updates the data in the cache. Now what would happen if client B tried to update the same data in the cache? Should client B override the value in the cache? Or should an exception be raised?
Windows Server AppFabric caching supports two modes to handle concurrency scenarios, namely Optimistic Concurrency and Pessimistic Concurrency. In this recipe...