LockRegistry
in package
LockRegistry is used internally by existing adapters to protect against cache stampede.
It does so by wrapping the computation of items in a pool of locks. Foreach each apps, there can be at most 20 concurrent processes that compute items at the same time and only one per cache-key.
Tags
Table of Contents
- $files : mixed
- The number of items in this list controls the max number of concurrent processes.
- $lockedFiles : mixed
- $openedFiles : mixed
- $signalingCallback : mixed
- $signalingException : mixed
- compute() : mixed
- setFiles() : array<string|int, mixed>
- Defines a set of existing files that will be used as keys to acquire locks.
- open() : mixed
Properties
$files
The number of items in this list controls the max number of concurrent processes.
private
static mixed
$files
= [__DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'AbstractAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'AbstractTagAwareAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'AdapterInterface.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'ApcuAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'ArrayAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'ChainAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'CouchbaseBucketAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'CouchbaseCollectionAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'DoctrineAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'DoctrineDbalAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'FilesystemAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'FilesystemTagAwareAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'MemcachedAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'NullAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'ParameterNormalizer.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'PdoAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'PhpArrayAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'PhpFilesAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'ProxyAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'Psr16Adapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'RedisAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'RedisTagAwareAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'TagAwareAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'TagAwareAdapterInterface.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'TraceableAdapter.php', __DIR__ . DIRECTORY_SEPARATOR . 'Adapter' . DIRECTORY_SEPARATOR . 'TraceableTagAwareAdapter.php']
$lockedFiles
private
static mixed
$lockedFiles
$openedFiles
private
static mixed
$openedFiles
= []
$signalingCallback
private
static mixed
$signalingCallback
$signalingException
private
static mixed
$signalingException
Methods
compute()
public
static compute(callable $callback, ItemInterface $item, bool &$save, CacheInterface $pool[, Closure|null $setMetadata = null ][, LoggerInterface|null $logger = null ]) : mixed
Parameters
- $callback : callable
- $item : ItemInterface
- $save : bool
- $pool : CacheInterface
- $setMetadata : Closure|null = null
- $logger : LoggerInterface|null = null
Return values
mixed —setFiles()
Defines a set of existing files that will be used as keys to acquire locks.
public
static setFiles(array<string|int, mixed> $files) : array<string|int, mixed>
Parameters
- $files : array<string|int, mixed>
Return values
array<string|int, mixed> —The previously defined set of files
open()
private
static open(int $key) : mixed
Parameters
- $key : int