For basic cache operations that do not use locking, expirations, or any other advanced features, AppFabric DataCache
calls can be replaced with the following ScaleOut NamedCache
calls:
AppFabric DataCache method | ScaleOut NamedCache method |
---|---|
DataCache.Add |
|
DataCache.Get |
|
DataCache.Put |
|
DataCache.Remove |
The NamedCache.Insert
method’s updateIfExists parameter allows the method to behave either like a DataCache.Add
or a DataCache.Put
call:
// "Put" an object that may or may not already exist in the SOSS service: NamedCache cache = CacheFactory.GetCache("Sample Cache"); cache.Insert("My key", "This is a value in the cache", cache.DefaultCreatePolicy, true, false);