Replaces an object in the cache if the specified object version matches
the version of object stored in the cache.
Namespace: Soss.Compat.WSAF
Assembly: soss_wsaf_compat (in soss_wsaf_compat.dll) Version: 1.1.0.100 (1.1.0.100)
Syntax
public DataCacheItemVersion Put( string key, Object value, DataCacheItemVersion oldVersion, TimeSpan timeout )
Parameters
- key
- Type: SystemString
The unique identifier used to access the object in the cache. - value
- Type: SystemObject
The object to add or replace in the cache. - oldVersion
- Type: Soss.Compat.WSAFDataCacheItemVersion
The DataCacheItemVersion object that represents the version of the cached object that is to be replaced. - timeout
- Type: SystemTimeSpan
The amount of time that the object should reside in the cache before expiration. The timeout parameter is ignored if object already exists.
Return Value
Type: DataCacheItemVersionThe DataCacheItemVersion object representing the version of the object after the Put operation completes, or null if there is a version mismatch.
Exceptions
Exception | Condition |
---|---|
DataCacheException | thrown if the WSAF Caching Compatibility Library is used with ScaleOut StateServer older than version 5.3 and object to update does not exist in the cache. |
Remarks
By passing the oldVersion parameter, this method can maintain concurrency. If another process updates the cached object before this method is called, this method does not update the cached object and returns null.
The timeout value associated with the cached object overrides expiration settings specified in the named cache configuration.
In the current release of this library a DataCacheException is thrown if the object does not exist in the cache. The next release of this library will support optimistic concurrency on non-existing objects.
See Also