class CacheCommandMutex implements CommandMutex (View source)

Traits

Properties

Factory $cache

The cache factory implementation.

string|null $store

The cache store that should be used.

Methods

int
secondsUntil(DateTimeInterface|DateInterval|int $delay)

Get the number of seconds until the given DateTime.

int
availableAt(DateTimeInterface|DateInterval|int $delay = 0)

Get the "available at" UNIX timestamp.

parseDateInterval(DateTimeInterface|DateInterval|int $delay)

If the given value is an interval, convert it to a DateTime instance.

int
currentTime()

Get the current system time as a UNIX timestamp.

__construct(Factory $cache)

Create a new command mutex.

bool
create(Command $command)

Attempt to obtain a command mutex for the given command.

bool
exists(Command $command)

Determine if a command mutex exists for the given command.

bool
forget(Command $command)

Release the mutex for the given command.

string
commandMutexName(Command $command)

Get the isolatable command mutex name.

$this
useStore(string|null $store)

Specify the cache store that should be used.

bool
shouldUseLocks(Store $store)

Determine if the given store should use locks for command mutexes.

Details

protected int secondsUntil(DateTimeInterface|DateInterval|int $delay)

Get the number of seconds until the given DateTime.

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

int

protected int availableAt(DateTimeInterface|DateInterval|int $delay = 0)

Get the "available at" UNIX timestamp.

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

int

protected DateTimeInterface|int parseDateInterval(DateTimeInterface|DateInterval|int $delay)

If the given value is an interval, convert it to a DateTime instance.

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

DateTimeInterface|int

protected int currentTime()

Get the current system time as a UNIX timestamp.

Return Value

int

__construct(Factory $cache)

Create a new command mutex.

Parameters

Factory $cache

bool create(Command $command)

Attempt to obtain a command mutex for the given command.

Parameters

Command $command

Return Value

bool

bool exists(Command $command)

Determine if a command mutex exists for the given command.

Parameters

Command $command

Return Value

bool

bool forget(Command $command)

Release the mutex for the given command.

Parameters

Command $command

Return Value

bool

protected string commandMutexName(Command $command)

Get the isolatable command mutex name.

Parameters

Command $command

Return Value

string

$this useStore(string|null $store)

Specify the cache store that should be used.

Parameters

string|null $store

Return Value

$this

protected bool shouldUseLocks(Store $store)

Determine if the given store should use locks for command mutexes.

Parameters

Store $store

Return Value

bool