$Cache¶
$Cache is a global object that can be used to store and retrieve objects in a non-persistent cache storage.
1 | |
Remarks¶
The cache is cleared when the application is restarted or when an item expires.
The cache also provides a locking mechanism for shared access to objects. The locking mechanism is based on a token value. The token value is generated by the $Cache.Lock or $Cache.TryLock method. The token value must be used to release the lock with the $Cache.ReleaseLock method. If the lock is not released before the timeout, it is automatically released after the transaction is completed.
Capabilities¶
Cache Storage¶
- CacheStatic.Get: Retrieves a cached value by its key, if it exists.
- CacheStatic.Set: Stores an object in the cache.
Locking¶
- CacheStatic.Lock: Attempts to acquire a lock for the specified key, blocking until the lock is acquired.
- CacheStatic.ReleaseLock: Releases a previously acquired lock.
- CacheStatic.TryLock: Attempts to acquire a lock for a shared key without blocking.