Repository
class Repository implements Repository, ArrayAccess mixin Store
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
protected Store | $store | The cache store implementation. |
|
protected Dispatcher | $events | The event dispatcher implementation. |
|
protected float|int | $default | The default number of minutes to store items. |
Methods
Dynamically handle calls to the class.
Handle dynamic calls into macros or pass missing methods to the store.
Determine if an item exists in the cache.
Retrieve an item from the cache by key.
Retrieve multiple items from the cache by key.
Handle a result for the "many" method.
Retrieve an item from the cache and delete it.
Store multiple items in the cache for a given number of minutes.
Increment the value of an item in the cache.
Decrement the value of an item in the cache.
Store an item in the cache indefinitely.
Get an item from the cache, or store the default value forever.
Remove an item from the cache.
Begin executing a new tags operation if the store supports it.
Format the key for a cache item.
Get the default cache time.
Set the default cache time in minutes.
Fire an event for this cache instance.
Determine if a cached value exists.
Retrieve an item from the cache by key.
Store an item in the cache for the default time.
Remove an item from the cache.
Clone cache repository instance.
Details
in
Macroable at line 24
static void
macro(string $name, callable $macro)
Register a custom macro.
in
Macroable at line 35
static bool
hasMacro(string $name)
Checks if macro is registered.
in
Macroable at line 49
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
at line 502
mixed
__call(string $method, array $parameters)
Handle dynamic calls into macros or pass missing methods to the store.
at line 55
void
__construct(Store $store)
Create a new cache repository instance.
at line 66
bool
has(string $key)
Determine if an item exists in the cache.
at line 78
mixed
get(string $key, mixed $default = null)
Retrieve an item from the cache by key.
at line 108
array
many(array $keys)
Retrieve multiple items from the cache by key.
Items not found in the cache will have a null value.
at line 127
protected mixed
handleManyResult(array $keys, string $key, mixed $value)
Handle a result for the "many" method.
at line 153
mixed
pull(string $key, mixed $default = null)
Retrieve an item from the cache and delete it.
at line 168
void
put(string $key, mixed $value, DateTime|float|int $minutes = null)
Store an item in the cache.
at line 188
void
putMany(array $values, float|int $minutes)
Store multiple items in the cache for a given number of minutes.
at line 207
bool
add(string $key, mixed $value, DateTime|float|int $minutes)
Store an item in the cache if the key does not exist.
at line 241
int|bool
increment(string $key, mixed $value = 1)
Increment the value of an item in the cache.
at line 253
int|bool
decrement(string $key, mixed $value = 1)
Decrement the value of an item in the cache.
at line 265
void
forever(string $key, mixed $value)
Store an item in the cache indefinitely.
at line 280
mixed
remember(string $key, DateTime|float|int $minutes, Closure $callback)
Get an item from the cache, or store the default value.
at line 303
mixed
sear(string $key, Closure $callback)
Get an item from the cache, or store the default value forever.
at line 315
mixed
rememberForever(string $key, Closure $callback)
Get an item from the cache, or store the default value forever.
at line 337
bool
forget(string $key)
Remove an item from the cache.
at line 352
TaggedCache
tags(array|mixed $names)
Begin executing a new tags operation if the store supports it.
at line 373
protected string
itemKey(string $key)
Format the key for a cache item.
at line 383
float|int
getDefaultCacheTime()
Get the default cache time.
at line 394
$this
setDefaultCacheTime(float|int $minutes)
Set the default cache time in minutes.
at line 406
Store
getStore()
Get the cache store implementation.
at line 417
protected void
event(string $event)
Fire an event for this cache instance.
at line 430
void
setEventDispatcher(Dispatcher $events)
Set the event dispatcher instance.
at line 441
bool
offsetExists(string $key)
Determine if a cached value exists.
at line 452
mixed
offsetGet(string $key)
Retrieve an item from the cache by key.
at line 464
void
offsetSet(string $key, mixed $value)
Store an item in the cache for the default time.
at line 475
void
offsetUnset(string $key)
Remove an item from the cache.
at line 486
protected float|int|null
getMinutes(DateTime|float|int $duration)
Calculate the number of minutes with the given duration.
at line 516
void
__clone()
Clone cache repository instance.