NamedCacheAsyncExtensionsPutAsync Method (NamedCache, Byte, 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 DefaultCreatePolicy for an unspecified createPolicy and creates a CachedObjectId from id.

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

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

Parameters

cache
Type: Soss.ClientNamedCache
the NamedCache this extension method operates on.
id
Type: SystemByte
a byte that will be transformed into a CachedObjectId via CreateKey(Byte) which identifies the object in the cache.
obj
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 is 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).
Exceptions

ExceptionCondition
ArgumentNullException when id is null.
See Also

Reference