AbstractRegistry
in package
implements
RegistryInterface
Registry abstract class
Tags
Table of Contents
Interfaces
- RegistryInterface
- Registry interface
Methods
- prune() : int
- Remove every record whose heartbeat is older than the given number of seconds, plus any stored entry that can no longer be decoded, returning how many were removed in total.
- decode() : WorkerRecord|null
- Decode a stored record, or null if the payload is unusable
- encode() : string
- Encode a record for storage
- isExpired() : bool
- Whether a record's heartbeat is older than the given number of seconds. Shared by every backend's prune() so the cutoff rule can't drift between them.
- purgeUndecodable() : int
- Remove stored entries that can no longer be decoded into a WorkerRecord, returning how many were removed.
Methods
prune()
Remove every record whose heartbeat is older than the given number of seconds, plus any stored entry that can no longer be decoded, returning how many were removed in total.
public
prune(int $olderThanSeconds) : int
Concrete here rather than per-backend: the expiry half is expressible purely in terms of all()/delete()/isExpired(), and four byte-identical copies would be four places for the rule to drift.
Parameters
- $olderThanSeconds : int
Return values
intdecode()
Decode a stored record, or null if the payload is unusable
protected
decode(string|null $payload) : WorkerRecord|null
Parameters
- $payload : string|null
Return values
WorkerRecord|nullencode()
Encode a record for storage
protected
encode(WorkerRecord $record) : string
JSON, deliberately - registry records are plain scalars and arrays, so this carries none of the unserialize() object-injection surface that job payloads do.
Parameters
- $record : WorkerRecord
Tags
Return values
stringisExpired()
Whether a record's heartbeat is older than the given number of seconds. Shared by every backend's prune() so the cutoff rule can't drift between them.
protected
isExpired(WorkerRecord $record, int $olderThanSeconds) : bool
Parameters
- $record : WorkerRecord
- $olderThanSeconds : int
Return values
boolpurgeUndecodable()
Remove stored entries that can no longer be decoded into a WorkerRecord, returning how many were removed.
protected
purgeUndecodable() : int
These are invisible to all() by design (it skips them so one corrupt entry cannot derail enumeration), which would otherwise make them permanently unreapable - a truncated write or a bad payload would leak for the lifetime of the store. Backends with real storage override this; the default is a no-op for backends that cannot hold an undecodable entry.