NamedCacheAsyncExtensionsRemoveAsync Method (NamedCache, Guid, IOptimisticConcurrencyVersionHolder, LockTicket, CancellationToken)

ScaleOut Software NamedCache API
Asynchronously removes the object with the given id from the cache. No exception will be thrown and no action will be taken if the specified object does not exist in the cache. This extension method is simply a convenience wrapper for SetMetadataAsync(CachedObjectId, ObjectMetadata, Boolean, LockTicket, CancellationToken) that 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 RemoveAsync(
	this NamedCache cache,
	Guid id,
	IOptimisticConcurrencyVersionHolder versionedObject = null,
	LockTicket lockTicket = null,
	CancellationToken cancellationToken = null
)

Parameters

cache
Type: Soss.ClientNamedCache
the NamedCache this extension method operates on.
id
Type: SystemGuid
a Guid that will be transformed into a CachedObjectId via CreateKey(Guid) which identifies the object in the cache.
versionedObject (Optional)
Type: Soss.ClientIOptimisticConcurrencyVersionHolder
if specified, the optimistic concurrency version held by versionedObject will be compared with the current object version held by the cache. The object will be deleted if and only if the versions match.
lockTicket (Optional)
Type: Soss.ClientLockTicket
An optional LockTicket obtained from a previous locking call. If lockTicket is specified, the object will be removed only if the object is currently locked with the given lockTicket. If both versionedObject and lockTicket are specified, versionedObject is ignored.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
An optional CancellationToken that can be used to cancel the asynchronous operation.

Return Value

Type: Task
an awaitable Task

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
InvalidOperationExceptionIf an unexpected return code is returned when removing the object from store.
See Also

Reference