ConcurrentRegion
extends
Region
in
Defines contract for concurrently managed data region.
It should be able to lock an specific cache entry in an atomic operation.
When a entry is locked another process should not be able to read or write the entry. All evict operation should not consider locks, even though an entry is locked evict should be able to delete the entry and its lock.
Table of Contents
Methods
- contains() : bool
- Determine whether this region contains data for the given key.
- evict() : bool
- Remove an item from the cache.
- evictAll() : bool
- Remove all contents of this particular cache region.
- get() : CacheEntry|null
- Get an item from the cache.
- getMultiple() : array<string|int, CacheEntry>|null
- Get all items from the cache identified by $keys.
- getName() : string
- Retrieve the name of this region.
- lock() : Lock|null
- Attempts to read lock the mapping for the given key.
- put() : bool
- Put an item into the cache.
- unlock() : bool
- Attempts to read unlock the mapping for the given key.
Methods
contains()
Determine whether this region contains data for the given key.
public
contains(CacheKey $key) : bool
Parameters
- $key : CacheKey
-
The cache key
Return values
bool —TRUE if the underlying cache contains corresponding data; FALSE otherwise.
evict()
Remove an item from the cache.
public
evict(CacheKey $key) : bool
Parameters
- $key : CacheKey
-
The key under which to cache the item.
Tags
Return values
boolevictAll()
Remove all contents of this particular cache region.
public
evictAll() : bool
Tags
Return values
boolget()
Get an item from the cache.
public
get(CacheKey $key) : CacheEntry|null
Parameters
- $key : CacheKey
-
The key of the item to be retrieved.
Tags
Return values
CacheEntry|null —The cached entry or NULL
getMultiple()
Get all items from the cache identified by $keys.
public
getMultiple(CollectionCacheEntry $collection) : array<string|int, CacheEntry>|null
It returns NULL if some elements can not be found.
Parameters
- $collection : CollectionCacheEntry
-
The collection of the items to be retrieved.
Return values
array<string|int, CacheEntry>|null —The cached entries or NULL if one or more entries can not be found
getName()
Retrieve the name of this region.
public
getName() : string
Return values
string —The region name
lock()
Attempts to read lock the mapping for the given key.
public
lock(CacheKey $key) : Lock|null
Parameters
- $key : CacheKey
-
The key of the item to lock.
Tags
Return values
Lock|null —A lock instance or NULL if the lock already exists.
put()
Put an item into the cache.
public
put(CacheKey $key, CacheEntry $entry[, Lock|null $lock = null ]) : bool
Parameters
- $key : CacheKey
-
The key under which to cache the item.
- $entry : CacheEntry
-
The entry to cache.
- $lock : Lock|null = null
-
The lock previously obtained.
Tags
Return values
boolunlock()
Attempts to read unlock the mapping for the given key.
public
unlock(CacheKey $key, Lock $lock) : bool