class DebounceLock

Traits

Methods

mixed
getAttributeValue(object $target, string $attributeClass, string|null $property = null, mixed $default = null)

Get a configuration value from an attribute, falling back to a property.

mixed
extractAttributeValue(object $instance)

Extract the value from an attribute instance.

object|null
getAttributeInstance(object $target, string $attributeClass, ReflectionClass|null $declaringClass = null)

Get an instance of the given attribute class from the target class or its parents.

bool
propertyOverridesAttribute(object $target, ReflectionClass $reflection, string|null $property, ReflectionClass $attributeDeclaringClass)

Determine if a property declared on a child class overrides an inherited attribute.

__construct(Repository $cache)

Create a new debounce lock manager instance.

array
acquire(mixed $job, int|null $debounceFor = null, int|null $maxWait = null)

Store a debounce owner token for the given job.

array
acquireForDispatch(object $job, int|null $debounceFor = null, int|null $maxWait = null)

Store and register a debounce owner token for a dispatch operation.

array
resolveLockValues(mixed $job, int|null $debounceFor, int|null $maxWait)

Resolve the values needed to acquire a debounce lock.

array
acquireResolvedLock(Repository $cache, string $key, int $ttl, int|null $maxWait)

Store a debounce owner token using resolved values.

bool
maxWaitExceeded(Repository $cache, string $key, int $ttl, int|null $maxWait)

Determine if the maximum debounce wait time has been exceeded.

string|null
getCurrentOwner(mixed $job)

Get the current owner for the given job.

void
release(mixed $job, string $owner = '')

Remove the debounce token for the given job.

void
releaseMaxWait(mixed $job)

Remove the maximum wait timestamp for the given job.

static void
releaseOwned(Repository $cache, string $key, string $owner = '')

Release a debounce lock from already-resolved provenance.

int|null
getDebounceDelay(mixed $job)

Get the debounce delay for the given job.

int|null
getMaxDebounceWait(mixed $job)

Get the maximum debounce wait time for the given job.

static string
getKey(mixed $job)

Generate the cache key for the given job.

resolveCache(mixed $job)

Resolve the cache store for the given job.

Details

protected mixed getAttributeValue(object $target, string $attributeClass, string|null $property = null, mixed $default = null)

Get a configuration value from an attribute, falling back to a property.

Parameters

object $target
string $attributeClass
string|null $property
mixed $default

Return Value

mixed

protected mixed extractAttributeValue(object $instance)

Extract the value from an attribute instance.

Parameters

object $instance

Return Value

mixed

protected object|null getAttributeInstance(object $target, string $attributeClass, ReflectionClass|null $declaringClass = null)

Get an instance of the given attribute class from the target class or its parents.

Parameters

object $target
string $attributeClass
ReflectionClass|null $declaringClass

Return Value

object|null

protected bool propertyOverridesAttribute(object $target, ReflectionClass $reflection, string|null $property, ReflectionClass $attributeDeclaringClass)

Determine if a property declared on a child class overrides an inherited attribute.

Parameters

object $target
ReflectionClass $reflection
string|null $property
ReflectionClass $attributeDeclaringClass

Return Value

bool

at line 21
__construct(Repository $cache)

Create a new debounce lock manager instance.

Parameters

Repository $cache

at line 33
array acquire(mixed $job, int|null $debounceFor = null, int|null $maxWait = null)

Store a debounce owner token for the given job.

Overwrites any existing token, implementing last-writer-wins semantics.

Parameters

mixed $job
int|null $debounceFor
int|null $maxWait

Return Value

array

at line 45
array acquireForDispatch(object $job, int|null $debounceFor = null, int|null $maxWait = null)

Store and register a debounce owner token for a dispatch operation.

Parameters

object $job
int|null $debounceFor
int|null $maxWait

Return Value

array

at line 64
protected array resolveLockValues(mixed $job, int|null $debounceFor, int|null $maxWait)

Resolve the values needed to acquire a debounce lock.

Parameters

mixed $job
int|null $debounceFor
int|null $maxWait

Return Value

array

at line 82
protected array acquireResolvedLock(Repository $cache, string $key, int $ttl, int|null $maxWait)

Store a debounce owner token using resolved values.

Parameters

Repository $cache
string $key
int $ttl
int|null $maxWait

Return Value

array

at line 107
protected bool maxWaitExceeded(Repository $cache, string $key, int $ttl, int|null $maxWait)

Determine if the maximum debounce wait time has been exceeded.

Parameters

Repository $cache
string $key
int $ttl
int|null $maxWait

Return Value

bool

at line 136
string|null getCurrentOwner(mixed $job)

Get the current owner for the given job.

Parameters

mixed $job

Return Value

string|null

at line 147
void release(mixed $job, string $owner = '')

Remove the debounce token for the given job.

Parameters

mixed $job
string $owner

Return Value

void

at line 157
void releaseMaxWait(mixed $job)

Remove the maximum wait timestamp for the given job.

Parameters

mixed $job

Return Value

void

at line 167
static void releaseOwned(Repository $cache, string $key, string $owner = '')

internal  
 

Release a debounce lock from already-resolved provenance.

Parameters

Repository $cache
string $key
string $owner

Return Value

void

at line 195
int|null getDebounceDelay(mixed $job)

Get the debounce delay for the given job.

Parameters

mixed $job

Return Value

int|null

at line 210
int|null getMaxDebounceWait(mixed $job)

Get the maximum debounce wait time for the given job.

Parameters

mixed $job

Return Value

int|null

at line 218
static string getKey(mixed $job)

Generate the cache key for the given job.

Parameters

mixed $job

Return Value

string

at line 235
protected Repository resolveCache(mixed $job)

Resolve the cache store for the given job.

Parameters

mixed $job

Return Value

Repository