Documentation

ConcurrentRegion extends Region

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
throws
CacheException

Indicates a problem accessing the region.

Return values
bool

evictAll()

Remove all contents of this particular cache region.

public evictAll() : bool
Tags
throws
CacheException

Indicates problem accessing the region.

Return values
bool

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
throws
LockException

Indicates a problem accessing the region.

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
throws
CacheException

Indicates a problem accessing the region.

Return values
bool

unlock()

Attempts to read unlock the mapping for the given key.

public unlock(CacheKey $key, Lock $lock) : bool
Parameters
$key : CacheKey

The key of the item to unlock.

$lock : Lock

The lock previously obtained from

Tags
throws
LockException

Indicates a problem accessing the region.

Return values
bool

        
On this page

Search results