FailoverStore
class FailoverStore extends TaggableStore implements CanFlushLocks, LockProvider, RawReadable
Constants
| protected FAILING_CACHES_CONTEXT_PREFIX |
Context key prefix for the caches which failed on the last action. Scoped per instance via spl_object_id() so multiple failover stores in the same coroutine don't share failure history. Stored in coroutine Context instead of an instance property because this store is a worker-lifetime singleton (cached in CacheManager::$stores). Instance state would leak across concurrent requests. |
Methods
Retrieve an item from the cache by key.
Retrieve an item from the cache by key without unwrapping sentinels.
Retrieve multiple items from the cache by key.
Retrieve multiple items by key without unwrapping sentinels.
Store an item in the cache for a given number of seconds.
Store multiple items in the cache for a given number of seconds.
Store an item in the cache if the key doesn't exist.
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.
Restore a lock instance using the owner identifier.
Adjust the expiration time of a cached item.
Remove an item from the cache.
Remove all items from the cache.
Remove all expired tag set entries.
Determine if the store can currently flush locks.
Flush all locks managed by the store.
Determine if the lock store is separate from the cache store.
Get the cache key prefix.
Attempt the given method until a store call does not throw.
Attempt the given method on every store.
Dispatch a newly observed store failure.
Get the cache store for the given store name.
Get every lock-capable backing store.
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.
at line 41
__construct(CacheManager $cache, Dispatcher $events, array $stores)
Create a new failover store.
at line 54
mixed
get(string $key)
Retrieve an item from the cache by key.
Store contract method — unwraps sentinels to null, matching the pre-refactor behavior (inner Repository's get() also unwrapped).
at line 59
mixed
getRaw(UnitEnum|string $key)
Retrieve an item from the cache by key without unwrapping sentinels.
at line 71
array
many(array $keys)
Retrieve multiple items from the cache by key.
Items not found in the cache will have a null value.
at line 79
array
manyRaw(array $keys)
Retrieve multiple items by key without unwrapping sentinels.
at line 87
bool
put(string $key, mixed $value, int $seconds)
Store an item in the cache for a given number of seconds.
at line 95
bool
putMany(array $values, int $seconds)
Store multiple items in the cache for a given number of seconds.
at line 103
bool
add(string $key, mixed $value, int $seconds)
Store an item in the cache if the key doesn't exist.
at line 111
bool|int
increment(string $key, int $value = 1)
Increment the value of an item in the cache.
at line 119
bool|int
decrement(string $key, int $value = 1)
Decrement the value of an item in the cache.
at line 127
bool
forever(string $key, mixed $value)
Store an item in the cache indefinitely.
at line 135
Lock
lock(string $name, int $seconds = 0, string|null $owner = null)
Get a lock instance.
at line 143
Lock
restoreLock(string $name, string $owner)
Restore a lock instance using the owner identifier.
at line 151
bool
touch(string $key, int $seconds)
Adjust the expiration time of a cached item.
at line 159
bool
forget(string $key)
Remove an item from the cache.
at line 174
bool
flush()
Remove all items from the cache.
at line 192
array|null
flushStaleTags()
Remove all expired tag set entries.
at line 208
bool
supportsFlushingLocks()
Determine if the store can currently flush locks.
at line 231
bool
flushLocks()
Flush all locks managed by the store.
at line 271
bool
hasSeparateLockStore()
Determine if the lock store is separate from the cache store.
at line 291
string
getPrefix()
Get the cache key prefix.
at line 301
protected mixed
attemptOnAllStores(string $method, array $arguments)
Attempt the given method until a store call does not throw.
at line 333
protected array
attemptOnEveryStore(string $method, array $arguments)
Attempt the given method on every store.
at line 364
protected void
recordStoreFailure(string $store, Throwable $exception, array $failingCaches)
Dispatch a newly observed store failure.
at line 378
protected Repository
store(string $store)
Get the cache store for the given store name.
at line 388
protected array
lockStores()
Get every lock-capable backing store.