When multiple threads are using cache, all the operations on cache are atomic. This means that no two threads can perform operations on the cache at the same time. Therefore, in this sense it is thread-safe.
However the order of different threads accessing the cache is not deterministic e.g. if there are multiple threads performing operations on the cache and if one thread first removes a key from the cache and then tries to add that same key again, It can still get ‘Key already exists’ exception because meanwhile another thread may have added the same key in the cache. This type of cases must be handled by the cache users explicitly.
To handle these type of cases please refer to the forum post (How to make NCache operations autonomous)
Is NCache thread safe? What happens if multiple threads try to add the same key?
No replies to this topic
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users