interface Repository implements CacheInterface

Methods

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|null $ttl = null)

Set the expiration of a cached item; null TTL will retain the item forever.

bool
forget(UnitEnum|string $key)

Remove an item from the cache.

getStore()

Get the cache store implementation.

Details

at line 23
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 28
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 33
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 38
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 43
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 48
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 58
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 72
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 86
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 96
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 109
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 122
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 135
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 140
bool touch(UnitEnum|string $key, DateInterval|DateTimeInterface|int|null $ttl = null)

Set the expiration of a cached item; null TTL will retain the item forever.

Parameters

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

Return Value

bool

at line 145
bool forget(UnitEnum|string $key)

Remove an item from the cache.

Parameters

UnitEnum|string $key

Return Value

bool

at line 150
Store getStore()

Get the cache store implementation.

Return Value

Store