interface Repository implements CacheInterface

Methods

mixed
get(array|UnitEnum|string $key, mixed $default = null)

Retrieve an item from the cache by key.

bool
set(UnitEnum|string $key, mixed $value, DateInterval|DateTimeInterface|int|null $ttl = null)

Store an item in the cache.

bool
delete(UnitEnum|string $key)

Remove an item from the cache.

iterable
getMultiple(iterable $keys, mixed $default = null)

Retrieve multiple items from the cache by key.

bool
setMultiple(iterable $values, DateInterval|DateTimeInterface|int|null $ttl = null)

Store multiple items in the cache.

bool
deleteMultiple(iterable $keys)

Remove multiple items from the cache by key.

bool
has(array|UnitEnum|string $key)

Determine if an item exists in the cache.

mixed
pull(UnitEnum|string $key, mixed $default = null)

Retrieve an item from the cache and delete it.

bool
put(array|UnitEnum|string $key, mixed $value, DateInterval|DateTimeInterface|int|null $ttl = null)

Store an item in the cache.

bool
add(UnitEnum|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(UnitEnum|string $key, int $value = 1)

Increment the value of an item in the cache.

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

Decrement the value of an item in the cache.

bool
forever(UnitEnum|string $key, mixed $value)

Store an item in the cache indefinitely.

mixed
remember(UnitEnum|string $key, Closure|DateInterval|DateTimeInterface|int|null $ttl, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result.

array
rememberWithWarmth(UnitEnum|string $key, Closure|DateInterval|DateTimeInterface|int|null $ttl, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result.

mixed
sear(UnitEnum|string $key, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result forever.

mixed
rememberForever(UnitEnum|string $key, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result forever.

mixed
rememberNullable(UnitEnum|string $key, DateInterval|DateTimeInterface|int|null $ttl, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result.

mixed
searNullable(UnitEnum|string $key, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result forever.

mixed
rememberForeverNullable(UnitEnum|string $key, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result forever.

bool
touch(UnitEnum|string $key, DateInterval|DateTimeInterface|int $ttl)

Set the expiration of a cached item.

bool
forget(array|UnitEnum|string $key)

Remove an item from the cache.

getStore()

Get the cache store implementation.

Details

at line 21
mixed get(array|UnitEnum|string $key, mixed $default = null)

Retrieve an item from the cache by key.

When an array is given, return a key-value map. Numeric entries are requested keys, while string-keyed entries use their values as defaults.

Parameters

array|UnitEnum|string $key
mixed $default

Return Value

mixed

at line 26
bool set(UnitEnum|string $key, mixed $value, DateInterval|DateTimeInterface|int|null $ttl = null)

Store an item in the cache.

Parameters

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

Return Value

bool

at line 31
bool delete(UnitEnum|string $key)

Remove an item from the cache.

Parameters

UnitEnum|string $key

Return Value

bool

at line 39
iterable getMultiple(iterable $keys, mixed $default = null)

Retrieve multiple items from the cache by key.

Parameters

iterable $keys
mixed $default

Return Value

iterable

at line 44
bool setMultiple(iterable $values, DateInterval|DateTimeInterface|int|null $ttl = null)

Store multiple items in the cache.

Parameters

iterable $values
DateInterval|DateTimeInterface|int|null $ttl

Return Value

bool

at line 51
bool deleteMultiple(iterable $keys)

Remove multiple items from the cache by key.

Parameters

iterable $keys

Return Value

bool

at line 56
bool has(array|UnitEnum|string $key)

Determine if an item exists in the cache.

Parameters

array|UnitEnum|string $key

Return Value

bool

at line 61
mixed pull(UnitEnum|string $key, mixed $default = null)

Retrieve an item from the cache and delete it.

Parameters

UnitEnum|string $key
mixed $default

Return Value

mixed

at line 66
bool put(array|UnitEnum|string $key, mixed $value, DateInterval|DateTimeInterface|int|null $ttl = null)

Store an item in the cache.

Parameters

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

Return Value

bool

at line 71
bool add(UnitEnum|string $key, mixed $value, DateInterval|DateTimeInterface|int|null $ttl = null)

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

Parameters

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

Return Value

bool

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

Increment the value of an item in the cache.

Parameters

UnitEnum|string $key
int $value

Return Value

bool|int

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

Decrement the value of an item in the cache.

Parameters

UnitEnum|string $key
int $value

Return Value

bool|int

at line 86
bool forever(UnitEnum|string $key, mixed $value)

Store an item in the cache indefinitely.

Parameters

UnitEnum|string $key
mixed $value

Return Value

bool

at line 96
mixed remember(UnitEnum|string $key, Closure|DateInterval|DateTimeInterface|int|null $ttl, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result.

Parameters

UnitEnum|string $key
Closure|DateInterval|DateTimeInterface|int|null $ttl
Closure $callback

Return Value

mixed

at line 110
array rememberWithWarmth(UnitEnum|string $key, Closure|DateInterval|DateTimeInterface|int|null $ttl, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result.

Parameters

UnitEnum|string $key
Closure|DateInterval|DateTimeInterface|int|null $ttl
Closure $callback

Return Value

array

the cached value and whether it was warm

at line 124
mixed sear(UnitEnum|string $key, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result forever.

Parameters

UnitEnum|string $key
Closure $callback

Return Value

mixed

at line 134
mixed rememberForever(UnitEnum|string $key, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result forever.

Parameters

UnitEnum|string $key
Closure $callback

Return Value

mixed

at line 147
mixed rememberNullable(UnitEnum|string $key, DateInterval|DateTimeInterface|int|null $ttl, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result.

Unlike remember(), a null return from $callback is stored and returned on subsequent calls rather than triggering re-execution.

Parameters

UnitEnum|string $key
DateInterval|DateTimeInterface|int|null $ttl
Closure $callback

Return Value

mixed

at line 160
mixed searNullable(UnitEnum|string $key, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result forever.

Unlike rememberForever(), a null return from $callback is stored and returned on subsequent calls rather than triggering re-execution.

Parameters

UnitEnum|string $key
Closure $callback

Return Value

mixed

at line 173
mixed rememberForeverNullable(UnitEnum|string $key, Closure $callback)

Get an item from the cache, or execute the given Closure and store the result forever.

Unlike rememberForever(), a null return from $callback is stored and returned on subsequent calls rather than triggering re-execution.

Parameters

UnitEnum|string $key
Closure $callback

Return Value

mixed

at line 178
bool touch(UnitEnum|string $key, DateInterval|DateTimeInterface|int $ttl)

Set the expiration of a cached item.

Parameters

UnitEnum|string $key
DateInterval|DateTimeInterface|int $ttl

Return Value

bool

at line 183
bool forget(array|UnitEnum|string $key)

Remove an item from the cache.

Parameters

array|UnitEnum|string $key

Return Value

bool

at line 188
Store getStore()

Get the cache store implementation.

Return Value

Store