class MemoizedStore implements AuthoritativeRawReadable, 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.

getInnerStore()

Get the underlying cache store.

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.

mixed
getAuthoritativeRaw(UnitEnum|string $key)

Retrieve an item without serving it from the memoized layer.

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 30
__construct(string $name, Repository $repository)

Create a new memoized cache instance.

Parameters

string $name
Repository $repository

at line 39
Store getInnerStore()

Get the underlying cache store.

Return Value

Store

at line 52
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 57
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 72
mixed getAuthoritativeRaw(UnitEnum|string $key)

Retrieve an item without serving it from the memoized layer.

Parameters

UnitEnum|string $key

Return Value

mixed

at line 84
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 92
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 127
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 137
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 149
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 159
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 169
bool forever(string $key, mixed $value)

Store an item in the cache indefinitely.

Parameters

string $key
mixed $value

Return Value

bool

at line 181
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 195
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 207
bool supportsFlushingLocks()

Determine if the store can currently flush locks.

Return Value

bool

at line 219
bool flushLocks()

Flush all locks managed by the store.

Return Value

bool

Exceptions

BadMethodCallException

at line 236
bool hasSeparateLockStore()

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

Return Value

bool

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

Adjust the expiration time of a cached item.

Parameters

string $key
int $seconds

Return Value

bool

at line 256
bool forget(string $key)

Remove an item from the cache.

Parameters

string $key

Return Value

bool

at line 266
bool flush()

Remove all items from the cache.

Return Value

bool

at line 276
string getPrefix()

Get the cache key prefix.

Return Value

string

at line 284
protected string prefix(string $key)

Prefix the given key.

Parameters

string $key

Return Value

string