WorkerArrayStore
class WorkerArrayStore extends AbstractArrayStore
Traits
Fallback implementations for stores without native multi-key operations.
Properties
| protected bool | $serializesValues | Indicates if values are serialized within the store. |
from AbstractArrayStore |
| protected array|bool|null | $serializableClasses | The classes that should be allowed during unserialization. |
from AbstractArrayStore |
| protected SerializableClassPolicy|null | $serializableClassPolicy | The shared serializable class policy. |
from AbstractArrayStore |
| protected array<string, array{value: mixed, expiresAt: float}> | $storage | The array of stored values. |
|
| protected CarbonImmutable}> | $locks | The array of locks. |
Methods
Get the number of seconds until the given DateTime.
Get the "available at" UNIX timestamp.
If the given value is an interval, convert it to a DateTime instance.
Given a start time, format the total run time for human readability.
Store multiple items in the cache for a given number of seconds.
Create a new array-family store.
Get all of the cached values and their expiration times.
Store an item in the cache for a given number of seconds.
Increment the value of an item in the cache.
Decrement the value of an item in the cache.
Store an item in the cache indefinitely.
Adjust the expiration time of a cached item.
Determine if the store can currently flush locks.
Get a lock instance.
Restore a lock instance using the owner identifier.
Determine if the lock store is separate from the cache store.
Get the lock record for the given name.
Store the lock record for the given name.
Remove the lock record for the given name.
Remove all lock records.
Get the cached item for the given key.
Store the cached item for the given key.
Remove the cached item for the given key.
Remove all cached items.
Get all cached items.
Get the UNIX timestamp, with milliseconds, for the given number of seconds in the future.
Details
in
TaggableStore at line 17
TaggedCache
tags(mixed $names)
Begin executing a new tags operation.
in
TaggableStore at line 31
bool
supportsTags()
Determine if this store currently supports tags.
Stores whose tag support depends on configuration or composition override this; for everything else extending TaggableStore, tag support is unconditional. A store that can return false here must also throw a NotSupportedException from tags() because Repository relies on the store to enforce its own conditional support.
in
TaggableStore at line 42
TagMode
getTagMode()
Get the tag mode this store operates under.
Default matches TaggableStore::tags() semantics (all-mode: keys are namespaced by the tag set). Subclasses override if they deviate.
in
InteractsWithTime at line 17
protected int
secondsUntil(DateInterval|DateTimeInterface|int $delay)
Get the number of seconds until the given DateTime.
in
InteractsWithTime at line 29
protected int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)
Get the "available at" UNIX timestamp.
in
InteractsWithTime at line 41
protected DateTimeInterface|int
parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)
If the given value is an interval, convert it to a DateTime instance.
in
InteractsWithTime at line 57
protected int
currentTime()
Get the current system time as a UNIX timestamp.
in
InteractsWithTime at line 65
protected string
runTimeForHumans(float $startTime, float|null $endTime = null)
Given a start time, format the total run time for human readability.
in
RetrievesMultipleKeys at line 21
array
many(array $keys)
Retrieve multiple items from the cache by key.
Items not found in the cache will have a null value.
in
RetrievesMultipleKeys at line 40
bool
putMany(array $values, int $seconds)
Store multiple items in the cache for a given number of seconds.
in
AbstractArrayStore at line 38
__construct(bool $serializesValues = false, array|bool|null $serializableClasses = null, SerializableClassPolicy|null $serializableClassPolicy = null)
Create a new array-family store.
in
AbstractArrayStore at line 53
array
all(bool $unserialize = true)
Get all of the cached values and their expiration times.
in
AbstractArrayStore at line 74
mixed
get(string $key)
Retrieve an item from the cache by key.
in
AbstractArrayStore at line 96
bool
put(string $key, mixed $value, int $seconds)
Store an item in the cache for a given number of seconds.
in
AbstractArrayStore at line 109
bool|int
increment(string $key, int $value = 1)
Increment the value of an item in the cache.
in
AbstractArrayStore at line 131
bool|int
decrement(string $key, int $value = 1)
Decrement the value of an item in the cache.
in
AbstractArrayStore at line 139
bool
forever(string $key, mixed $value)
Store an item in the cache indefinitely.
in
AbstractArrayStore at line 147
bool
touch(string $key, int $seconds)
Adjust the expiration time of a cached item.
in
AbstractArrayStore at line 164
bool
forget(string $key)
Remove an item from the cache.
in
AbstractArrayStore at line 172
bool
flush()
Remove all items from the cache.
in
AbstractArrayStore at line 182
bool
supportsFlushingLocks()
Determine if the store can currently flush locks.
in
AbstractArrayStore at line 192
bool
flushLocks()
Remove all locks from the store.
in
AbstractArrayStore at line 206
string
getPrefix()
Get the cache key prefix.
in
AbstractArrayStore at line 214
Lock
lock(string $name, int $seconds = 0, string|null $owner = null)
Get a lock instance.
in
AbstractArrayStore at line 222
Lock
restoreLock(string $name, string $owner)
Restore a lock instance using the owner identifier.
in
AbstractArrayStore at line 230
bool
hasSeparateLockStore()
Determine if the lock store is separate from the cache store.
at line 82
array|null
getLockRecord(string $name)
Get the lock record for the given name.
at line 92
void
putLockRecord(string $name, array $record)
Store the lock record for the given name.
at line 100
void
forgetLockRecord(string $name)
Remove the lock record for the given name.
at line 108
void
clearLockRecords()
Remove all lock records.
at line 30
protected array|null
getCacheItem(string $key)
Get the cached item for the given key.
at line 40
protected void
putCacheItem(string $key, array $item)
Store the cached item for the given key.
at line 48
protected bool
forgetCacheItem(string $key)
Remove the cached item for the given key.
at line 62
protected void
clearCacheItems()
Remove all cached items.
at line 72
protected array
getCacheItems()
Get all cached items.
in
AbstractArrayStore at line 293
protected float
calculateExpiration(int $seconds)
Get the expiration time of the key.
in
AbstractArrayStore at line 301
protected float
toTimestamp(int $seconds)
Get the UNIX timestamp, with milliseconds, for the given number of seconds in the future.
in
AbstractArrayStore at line 309
protected mixed
unserialize(string $value)
Unserialize the given value.