NamedCacheAsyncExtensionsPutAsync Method (NamedCache, CachedObjectId, Object, CreatePolicy, PutOptions, LockTicket, CancellationToken)

ScaleOut Software NamedCache API
Asynchronously creates or updates a serializable object within a named cache. This extension method is simply a convenience wrapper for PutAsync(CachedObjectId, Object, CreatePolicy, PutOptions, LockTicket, CancellationToken) which supplies defaults for various parameters.

Namespace:  Soss.Client.Extensions
Assembly:  soss_namedcache (in soss_namedcache.dll) Version:

public static Task<AsyncPutResult> PutAsync(
	this NamedCache cache,
	CachedObjectId id,
	Object obj,
	CreatePolicy createPolicy = null,
	PutOptions putOptions = PutOptions.None,
	LockTicket lockTicket = null,
	CancellationToken cancellationToken = null


Type: Soss.ClientNamedCache
the NamedCache this extension method operates on.
Type: Soss.ClientCachedObjectId
a CachedObjectId identifying the object in the cache.
Type: SystemObject
Serializable object to store in the cache. The argument cannot be null.
createPolicy (Optional)
Type: Soss.ClientCreatePolicy
A CreatePolicy instance containing extended cache policy information for the object. In this method, if the optional createPolicy parameter is null and neither ObjectMustExist nor ObjectMustNotExist bits are set for the putOptions parameter, then DefaultCreatePolicy for cache is used instead. When createPolicy parameter is null and the ObjectMustNotExist bit is set for the putOptions parameter is thrown.
putOptions (Optional)
Type: PutOptions
Optional PutOptions flags governing various locking and object existence requirements. In this extension method, if putOptions os not specified, the value None is used.
lockTicket (Optional)
Type: Soss.ClientLockTicket
An optional LockTicket obtained from a previous locking call
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
An optional CancellationToken that can be used to cancel the asynchronous operation.

Return Value

Type: TaskAsyncPutResult
a Task-wrapped AsyncPutResult which returns an indication as to whether the object was created or updated and any lockTicket resulting from a lock operation.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type NamedCache. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

ArgumentNullException when id is null.
See Also