Assembly: soss_namedcache (in soss_namedcache.dll) Version: 188.8.131.52
- Type: SystemString
Return ValueType: Boolean
true if the object is in cache, otherwise false
The result of the Contains method is only accurate at the moment of the method's invocation; other clients may add or remove the object from the cache in the instant between the call to Contains and any subsequent code. As such, the Contains method is not well-suited for applications which require distributed synchronization and should only be used in a single-client scenario.
A safer, more reliable approach to distributed synchronization is to first attempt a retrieval of the cached object through a call to Retrieve(String, Boolean), which returns the object's data and optionally locks the object for exclusive use by the client. If the object does not exist then it can be added to the cache by using Add(String, Object) or ItemString, which are safe to use with other clients that may be trying to add the object at the same instant. See the example in the NamedCache overview for an illustration of this pattern.