Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Overview

Tries to acquire a lock for the enclosure key until the lock is retrieved.

string $Cache.Lock(key: string)

Tries to acquire a lock for shared key, until lock has acquired or timeout.

string $Cache.Lock(key: string, blockingTimeout: string)

Arguments

string key
Lock key. Key is a unique identifier for shared access. Required.
string blockingTimeout
Duration of waiting timeout in hh:mm:ss format. Default value is 60 second.

Remarks

Acquired lock always must be released with $Cache.ReleaseLock method with generated token value. Otherwise lock is kept for long period until it's expire. (Default 5 min)

Example

$Cache.Set('myint', 4);
var tokenValue = $Cache.Lock('myint');
// Locked code block
$Cache.ReleaseLock('myint',tokenValue);

Remarks

Acquired lock always must be released with $Cache.ReleaseLock method with generated token value. Otherwise lock is kept for long period until it's expire. (Default 5 min)

Example

$Cache.Set('myint', 4);
var tokenValue = $Cache.Lock('myint');
// Locked code block
$Cache.ReleaseLock('myint',tokenValue);

Examples

$Cache.Set('myint', 4);
var tokenValue = $Cache.Lock('myint');
// Locked code block
$Cache.ReleaseLock('myint',tokenValue);
  • No labels