Documentation

FileLockRegion
in package
implements ConcurrentRegion

Very naive concurrent region, based on file locks.

Table of Contents

Interfaces

ConcurrentRegion
Defines contract for concurrently managed data region.

Constants

LOCK_EXTENSION  = 'lock'

Properties

$directory  : string
$lockLifetime  : mixed
$region  : Region

Methods

__construct()  : mixed
contains()  : mixed
{@inheritDoc}
evict()  : mixed
{@inheritDoc}
evictAll()  : mixed
{@inheritDoc}
get()  : mixed
{@inheritDoc}
getMultiple()  : mixed
{@inheritDoc}
getName()  : mixed
{@inheritDoc}
lock()  : Lock|null
Attempts to read lock the mapping for the given key.
put()  : mixed
{@inheritDoc}
unlock()  : bool
Attempts to read unlock the mapping for the given key.
getLockContent()  : string|false
getLockFileName()  : string
getLockTime()  : int|false
isLocked()  : bool

Constants

Properties

$lockLifetime

private mixed $lockLifetime
Tags
psalm-var

numeric-string

Methods

__construct()

public __construct(Region $region, string $directory, numeric-string $lockLifetime) : mixed
Parameters
$region : Region
$directory : string
$lockLifetime : numeric-string
Tags
throws
InvalidArgumentException

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.

Return values
Lock|null

A lock instance or NULL if the lock already exists.

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

Return values
bool

getLockContent()

private getLockContent(string $filename) : string|false
Parameters
$filename : string
Return values
string|false

getLockTime()

private getLockTime(string $filename) : int|false
Parameters
$filename : string
Return values
int|false

        
On this page

Search results