Reputation: 1
Using .NET 3.5. I'm storing customer objects in the cache using ReaderWriterLockSlim. The problem is that when a user from Customer A is doing an action that will result in a update to the customer object in the cache; the EnterWriteLock() will temperary stop all users from reading the customer objects from the cache eventhough they may belong to Customer B and have a different customer object.
Upvotes: 0
Views: 436
Reputation: 9712
I was trying to do something similar recently. I ended up locking the object in the cache instead of the cache itself. There are drawbacks to this approach but it might work for what you are doing.
Link (Code is VB.Net): Synclock on an object in the Cache
Upvotes: 1