RedisStore
class RedisStore extends TaggableStore implements CanFlushLocks, LockProvider
Properties
| protected Factory | $redis | ||
| protected string | $prefix | A string that should be prepended to keys. |
|
| protected string | $connection | The Redis connection instance that should be used to manage locks. |
|
| protected string | $lockConnection | The name of the connection that should be used for locks. |
|
| protected TagMode | $tagMode | The tag mode (All or Any). |
|
| protected array|bool|null | $serializableClasses | The classes that should be allowed during unserialization. |
|
| protected SerializableClassPolicy|null | $serializableClassPolicy | The shared serializable class policy. |
Methods
Begin executing a new tags operation.
Get the tag mode.
Create a new Redis store.
Retrieve an item from the cache by key.
Retrieve multiple items from the cache by key.
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.
Determine if the store can currently flush locks.
Remove all locks from the store.
Get the any tag operations container.
Get the all tag operations container.
Remove all expired tag set entries.
Set the tag mode.
Pin a pool connection for the duration of a callback.
Get the Redis connection instance.
Get the Redis connection instance that should be used to manage locks.
Determine if the lock store is separate from the cache store.
Specify the name of the connection that should be used to store data.
Specify the name of the connection that should be used to manage locks.
Get the cache key prefix.
Set the cache key prefix.
Get the StoreContext instance.
Get the Serialization instance.
Details
at line 291
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.
at line 345
TagMode
getTagMode()
Get the tag mode.
at line 111
__construct(Factory $redis, string $prefix = '', string $connection = 'default', array|bool|null $serializableClasses = null, SerializableClassPolicy|null $serializableClassPolicy = null)
Create a new Redis store.
at line 128
mixed
get(string $key)
Retrieve an item from the cache by key.
at line 137
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 145
bool
put(string $key, mixed $value, int $seconds)
Store an item in the cache for a given number of seconds.
at line 153
bool
putMany(array $values, int $seconds)
Store multiple items in the cache for a given number of seconds.
at line 161
bool
add(string $key, mixed $value, int $seconds)
Store an item in the cache if the key doesn't exist.
at line 169
bool|int
increment(string $key, int $value = 1)
Increment the value of an item in the cache.
at line 177
bool|int
decrement(string $key, int $value = 1)
Decrement the value of an item in the cache.
at line 185
bool
forever(string $key, mixed $value)
Store an item in the cache indefinitely.
at line 193
Lock
lock(string $name, int $seconds = 0, string|null $owner = null)
Get a lock instance.
at line 201
Lock
restoreLock(string $name, string $owner)
Restore a lock instance using the owner identifier.
at line 209
bool
touch(string $key, int $seconds)
Adjust the expiration time of a cached item.
at line 221
bool
forget(string $key)
Remove an item from the cache.
at line 233
bool
flush()
Remove all items from the cache.
at line 241
bool
supportsFlushingLocks()
Determine if the store can currently flush locks.
at line 251
bool
flushLocks()
Remove all locks from the store.
at line 267
AnyTagOperations
anyTagOps()
Get the any tag operations container.
Use this to access all any-mode tagged cache operations.
at line 280
AllTagOperations
allTagOps()
Get the all tag operations container.
Use this to access all all-mode tagged cache operations.
at line 316
array|null
flushStaleTags()
Remove all expired tag set entries.
Returns an array of snake_case stat keys with integer values, or null if no stats are available.
at line 331
RedisStore
setTagMode(TagMode|string $mode)
Set the tag mode.
Boot-only. Mutates state on a per-worker singleton; runtime mutation races across coroutines.
at line 356
mixed
withPinnedConnection(callable $callback)
Pin a pool connection for the duration of a callback.
All Redis operations inside the callback reuse the same connection, avoiding multiple pool checkouts.
at line 364
RedisProxy
connection()
Get the Redis connection instance.
at line 372
RedisProxy
lockConnection()
Get the Redis connection instance that should be used to manage locks.
at line 380
bool
hasSeparateLockStore()
Determine if the lock store is separate from the cache store.
at line 392
void
setConnection(string|null $connection)
Specify the name of the connection that should be used to store data.
Boot-only. Persists on the cached store for the worker lifetime and triggers cache invalidation of resolved operations; per-request use races across coroutines.
at line 404
RedisStore
setLockConnection(string $connection)
Specify the name of the connection that should be used to manage locks.
Boot-only. Persists on the cached store for the worker lifetime; per-request use races across coroutines.
at line 414
string
getPrefix()
Get the cache key prefix.
at line 422
Factory
getRedis()
Get the Redis database instance.
at line 434
void
setPrefix(string|null $prefix)
Set the cache key prefix.
Boot-only. Persists on the cached store for the worker lifetime and triggers cache invalidation of resolved operations; per-request use races across coroutines.
at line 443
StoreContext
getContext()
Get the StoreContext instance.
at line 456
Serialization
getSerialization()
Get the Serialization instance.