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.Client.NamedCache
the NamedCache this extension method operates on. - id
- Type: System.Guid
a Guid that will be transformed into a CachedObjectId via CreateKey(Guid) which identifies the object in the cache. - versionedObject (Optional)
- Type: Soss.Client.IOptimisticConcurrencyVersionHolder
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.Client.LockTicket
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.Threading.CancellationToken
An optional CancellationToken that can be used to cancel the asynchronous operation.
Return Value
Type: Taskan 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
Exception | Condition |
---|---|
InvalidOperationException | If an unexpected return code is returned when removing the object from store. |
See Also