Share via


DataCache.Unlock Method (String, DataCacheLockHandle, TimeSpan)

Releases objects locked in the cache. This method supports pessimistic concurrency by making sure that the appropriate DataCacheLockHandle is used for unlocking the object. Specifies a new timeout value for the cached object.

Namespace: Microsoft.ApplicationServer.Caching
Assembly: Microsoft.ApplicationServer.Caching.Client (in microsoft.applicationserver.caching.client.dll)

Usage

'Usage
Dim instance As DataCache
Dim key As String
Dim lockHandle As DataCacheLockHandle
Dim timeout As TimeSpan

instance.Unlock(key, lockHandle, timeout)

Syntax

'Declaration
Public Sub Unlock ( _
    key As String, _
    lockHandle As DataCacheLockHandle, _
    timeout As TimeSpan _
)
public void Unlock (
    string key,
    DataCacheLockHandle lockHandle,
    TimeSpan timeout
)
public:
void Unlock (
    String^ key, 
    DataCacheLockHandle^ lockHandle, 
    TimeSpan timeout
)
public void Unlock (
    String key, 
    DataCacheLockHandle lockHandle, 
    TimeSpan timeout
)
public function Unlock (
    key : String, 
    lockHandle : DataCacheLockHandle, 
    timeout : TimeSpan
)

Parameters

  • key
    The unique value that is used to identify the object in the region.
  • timeout
    The amount of time that the object should reside in the cache before expiration.

Remarks

The lockHandle parameter is required and must match the DataCacheLockHandle of the locked object to succeed. For more information about concurrency, see Concurrency Models and Concurrency Methods.

Locked objects are never expired, but they may expire immediately if unlocked after their expiration time. For more information, see Expiration and Eviction.

The timeout value associated with the cached object overrides expiration settings specified in the named cache configuration. For more information, see Expiration and Eviction.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Visual Studio 2010 and later, .NET Framework 4

Target Platforms

Windows 7; Windows Server 2008 R2; Windows Server 2008 Service Pack 2; Windows Vista Service Pack 2

See Also

Reference

DataCache Class
DataCache Members
Microsoft.ApplicationServer.Caching Namespace

  ff425062(v=azure.10).md 2011-08-26