class MemoizedStore extends TaggableStore implements AuthoritativeRawReadable, CanFlushLocks, LockProvider, RawReadable

Properties

protected array<string, mixed> $cache

The memoized cache values.

protected MemoizedTaggedCache> $taggedCaches

The memoized tagged cache instances.

Methods

tags(mixed $names)

Begin executing a new tags operation.

bool
supportsTags()

Determine if the underlying store currently supports tags.

TagMode
getTagMode()

Get the tag mode of the underlying store.

__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 without unwrapping sentinels.

mixed
memoize(string $key, Closure $callback)

Get a memoized raw value, resolving a miss with the given callback.

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 from the cache 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
add(string $key, mixed $value, DateInterval|DateTimeInterface|int|null $ttl = null)

Store an item in the cache if the key does not exist.

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.

void
forgetMemoized(string $key)

Forget a memoized value without changing the underlying cache.

bool
flush()

Remove all items from the cache.

void
flushTagged()

Remove all memoized items from the tagged caches.

void
flushMemoized()

Forget all memoized values without changing the underlying cache.

string
getPrefix()

Get the cache key prefix.

string
prefix(string $key)

Prefix the given key.

Details

at line 303
TaggedCache tags(mixed $names)

Begin executing a new tags operation.

Parameters

mixed $names

Return Value

TaggedCache

Exceptions

BadMethodCallException
NotSupportedException

at line 323
bool supportsTags()

Determine if the underlying store currently supports tags.

Return Value

bool

at line 333
TagMode getTagMode()

Get the tag mode of the underlying store.

Return Value

TagMode

Exceptions

BadMethodCallException

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

Create a new memoized cache instance.

Parameters

string $name
Repository $repository

at line 50
Store getInnerStore()

Get the underlying cache store.

Return Value

Store

at line 61
mixed get(string $key)

Retrieve an item from the cache by key.

Cached null sentinels are unwrapped to null. The raw value is memoized, so later getRaw() calls still see the sentinel.

Parameters

string $key

Return Value

mixed

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

Retrieve an item from the cache 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 86
mixed memoize(string $key, Closure $callback)

Get a memoized raw value, resolving a miss with the given callback.

Parameters

string $key
Closure $callback

Return Value

mixed

at line 100
mixed getAuthoritativeRaw(UnitEnum|string $key)

Retrieve an item without serving it from the memoized layer.

Parameters

UnitEnum|string $key

Return Value

mixed

at line 112
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 123
array manyRaw(array $keys)

Retrieve multiple items from the cache 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 158
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 168
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 183
bool add(string $key, mixed $value, DateInterval|DateTimeInterface|int|null $ttl = null)

Store an item in the cache if the key does not exist.

The underlying repository decides whether the key exists, because a memoized value may be stale.

Parameters

string $key
mixed $value
DateInterval|DateTimeInterface|int|null $ttl

Return Value

bool

at line 193
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 203
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 213
bool forever(string $key, mixed $value)

Store an item in the cache indefinitely.

Parameters

string $key
mixed $value

Return Value

bool

at line 225
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 239
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 251
bool supportsFlushingLocks()

Determine if the store can currently flush locks.

Return Value

bool

at line 263
bool flushLocks()

Flush all locks managed by the store.

Return Value

bool

Exceptions

BadMethodCallException

at line 280
bool hasSeparateLockStore()

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

Return Value

bool

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

Adjust the expiration time of a cached item.

Parameters

string $key
int $seconds

Return Value

bool

at line 347
bool forget(string $key)

Remove an item from the cache.

Parameters

string $key

Return Value

bool

at line 357
void forgetMemoized(string $key)

Forget a memoized value without changing the underlying cache.

Parameters

string $key

Return Value

void

at line 365
bool flush()

Remove all items from the cache.

Return Value

bool

at line 376
void flushTagged()

Remove all memoized items from the tagged caches.

Return Value

void

at line 386
void flushMemoized()

Forget all memoized values without changing the underlying cache.

Return Value

void

at line 396
string getPrefix()

Get the cache key prefix.

Return Value

string

at line 404
protected string prefix(string $key)

Prefix the given key.

Parameters

string $key

Return Value

string