class MemoizedStore implements CanFlushLocks, LockProvider, RawReadable, Store

Properties

protected array<string, mixed> $cache

The memoized cache values.

Methods

__construct(string $name, Repository $repository)

Create a new memoized cache instance.

mixed
get(string $key)

Retrieve an item from the cache by key.

mixed
getRaw(UnitEnum|string $key)

Retrieve an item from the cache by key without unwrapping sentinels.

array
many(array $keys)

Retrieve multiple items from the cache by key.

array
manyRaw(array $keys)

Retrieve multiple items by key without unwrapping sentinels.

bool
put(string $key, mixed $value, int $seconds)

Store an item in the cache for a given number of seconds.

bool
putMany(array $values, int $seconds)

Store multiple items in the cache for a given number of seconds.

bool|int
increment(string $key, int $value = 1)

Increment the value of an item in the cache.

bool|int
decrement(string $key, int $value = 1)

Decrement the value of an item in the cache.

bool
forever(string $key, mixed $value)

Store an item in the cache indefinitely.

lock(string $name, int $seconds = 0, string|null $owner = null)

Get a lock instance.

restoreLock(string $name, string $owner)

Restore a lock instance using the owner identifier.

bool
supportsFlushingLocks()

Determine if the store can currently flush locks.

bool
flushLocks()

Flush all locks managed by the store.

bool
hasSeparateLockStore()

Determine if the lock store is separate from the cache store.

bool
touch(string $key, int $seconds)

Adjust the expiration time of a cached item.

bool
forget(string $key)

Remove an item from the cache.

bool
flush()

Remove all items from the cache.

string
getPrefix()

Get the cache key prefix.

string
prefix(string $key)

Prefix the given key.

Details

at line 29
__construct(string $name, Repository $repository)

Create a new memoized cache instance.

Parameters

string $name
Repository $repository

at line 43
mixed get(string $key)

Retrieve an item from the cache by key.

Store contract method — returns the value with sentinels unwrapped to null, matching the pre-refactor behavior (which returned whatever the inner Repository's get() returned, i.e., unwrapped). Memoizes the raw value so subsequent getRaw() calls see the sentinel.

Parameters

string $key

Return Value

mixed

at line 48
mixed getRaw(UnitEnum|string $key)

Retrieve an item from the cache by key without unwrapping sentinels.

Parameters

UnitEnum|string $key

Return Value

mixed

the raw stored value — may be null (genuine miss), Hypervel\Cache\NullSentinel::VALUE (cached-null via the nullable cache methods), or a real cached value

at line 65
array many(array $keys)

Retrieve multiple items from the cache by key.

Items not found in the cache will have a null value.

Parameters

array $keys

Return Value

array

at line 73
array manyRaw(array $keys)

Retrieve multiple items by key without unwrapping sentinels.

Parameters

array $keys

Return Value

array

keyed by the input keys; values are raw (may include null, NullSentinel::VALUE, or real values)

at line 108
bool put(string $key, mixed $value, int $seconds)

Store an item in the cache for a given number of seconds.

Parameters

string $key
mixed $value
int $seconds

Return Value

bool

at line 118
bool putMany(array $values, int $seconds)

Store multiple items in the cache for a given number of seconds.

Parameters

array $values
int $seconds

Return Value

bool

at line 130
bool|int increment(string $key, int $value = 1)

Increment the value of an item in the cache.

Parameters

string $key
int $value

Return Value

bool|int

at line 140
bool|int decrement(string $key, int $value = 1)

Decrement the value of an item in the cache.

Parameters

string $key
int $value

Return Value

bool|int

at line 150
bool forever(string $key, mixed $value)

Store an item in the cache indefinitely.

Parameters

string $key
mixed $value

Return Value

bool

at line 162
Lock lock(string $name, int $seconds = 0, string|null $owner = null)

Get a lock instance.

Parameters

string $name
int $seconds
string|null $owner

Return Value

Lock

Exceptions

BadMethodCallException

at line 176
Lock restoreLock(string $name, string $owner)

Restore a lock instance using the owner identifier.

Parameters

string $name
string $owner

Return Value

Lock

Exceptions

BadMethodCallException

at line 188
bool supportsFlushingLocks()

Determine if the store can currently flush locks.

Return Value

bool

at line 200
bool flushLocks()

Flush all locks managed by the store.

Return Value

bool

Exceptions

BadMethodCallException

at line 217
bool hasSeparateLockStore()

Determine if the lock store is separate from the cache store.

Return Value

bool

at line 227
bool touch(string $key, int $seconds)

Adjust the expiration time of a cached item.

Parameters

string $key
int $seconds

Return Value

bool

at line 237
bool forget(string $key)

Remove an item from the cache.

Parameters

string $key

Return Value

bool

at line 247
bool flush()

Remove all items from the cache.

Return Value

bool

at line 257
string getPrefix()

Get the cache key prefix.

Return Value

string

at line 265
protected string prefix(string $key)

Prefix the given key.

Parameters

string $key

Return Value

string