Repository
Implements
Uses
Properties
$default int|null
The default number of seconds to store items.
Methods
__construct ( Store $store ) : void
Create a new cache repository instance.
Parameters
- $store Store
has ( $key ) : bool
Determine if an item exists in the cache.
Parameters
- $key array|string
missing ( $key ) : bool
Determine if an item doesn't exist in the cache.
Parameters
- $key string
get ( $key , $default ) : mixed
Retrieve an item from the cache by key.
Parameters
- $key array|string
- $default TCacheValue|callable
many ( array $keys ) : array
Retrieve multiple items from the cache by key.
Parameters
- $keys array
getMultiple ( $keys , $default ) : iterable
{@inheritdoc}
handleManyResult ( $keys , $key , $value ) : mixed
Handle a result for the "many" method.
Parameters
- $keys array
- $key string
- $value mixed
pull ( $key , $default ) : mixed
Retrieve an item from the cache and delete it.
Parameters
- $key array|string
- $default TCacheValue|callable
put ( $key , $value , $ttl ) : bool
Store an item in the cache.
Parameters
- $key array|string
- $value mixed
- $ttl DateTimeInterface |DateInterval |int|null
set ( $key , $value , $ttl ) : bool
{@inheritdoc}
putMany ( array $values , $ttl ) : bool
Store multiple items in the cache for a given number of seconds.
Parameters
- $values array
- $ttl DateTimeInterface |DateInterval |int|null
putManyForever ( array $values ) : bool
Store multiple items in the cache indefinitely.
Parameters
- $values array
setMultiple ( $values , $ttl ) : bool
{@inheritdoc}
add ( $key , $value , $ttl ) : bool
Store an item in the cache if the key does not exist.
Parameters
- $key string
- $value mixed
- $ttl DateTimeInterface |DateInterval |int|null
increment ( $key , $value ) : int|bool
Increment the value of an item in the cache.
Parameters
- $key string
- $value mixed
decrement ( $key , $value ) : int|bool
Decrement the value of an item in the cache.
Parameters
- $key string
- $value mixed
forever ( $key , $value ) : bool
Store an item in the cache indefinitely.
Parameters
- $key string
- $value mixed
remember ( $key , $ttl , Closure $callback ) : TCacheValue
Get an item from the cache, or execute the given Closure and store the result.
Parameters
- $key string
- $ttl Closure |DateTimeInterface |DateInterval |int|null
-
$
Closure
TCacheValue $callback
sear ( $key , Closure $callback ) : TCacheValue
Get an item from the cache, or execute the given Closure and store the result forever.
Parameters
- $key string
-
$
Closure
TCacheValue $callback
rememberForever ( $key , Closure $callback ) : TCacheValue
Get an item from the cache, or execute the given Closure and store the result forever.
Parameters
- $key string
-
$
Closure
TCacheValue $callback
forget ( $key ) : bool
Remove an item from the cache.
Parameters
- $key string
delete ( $key ) : bool
{@inheritdoc}
deleteMultiple ( $keys ) : bool
{@inheritdoc}
clear ( ) : bool
{@inheritdoc}
tags ( $names ) : TaggedCache
Begin executing a new tags operation if the store supports it.
Parameters
- $names array|mixed
itemKey ( $key ) : string
Format the key for a cache item.
Parameters
- $key string
getSeconds ( $ttl ) : int
Calculate the number of seconds for the given TTL.
Parameters
- $ttl DateTimeInterface |DateInterval |int
supportsTags ( ) : bool
Determine if the current store supports tags.
getDefaultCacheTime ( ) : int|null
Get the default cache time.
setDefaultCacheTime ( $seconds ) : $this
Set the default cache time in seconds.
Parameters
- $seconds int|null
event ( $event ) : void
Fire an event for this cache instance.
Parameters
- $event object|string
setEventDispatcher ( Dispatcher $events ) : void
Set the event dispatcher instance.
Parameters
- $events Dispatcher
offsetExists ( $key ) : bool
Determine if a cached value exists.
Parameters
- $key string
offsetGet ( $key ) : mixed
Retrieve an item from the cache by key.
Parameters
- $key string
offsetSet ( $key , $value ) : void
Store an item in the cache for the default time.
Parameters
- $key string
- $value mixed
offsetUnset ( $key ) : void
Remove an item from the cache.
Parameters
- $key string
__call ( $method , $parameters ) : mixed
Handle dynamic calls into macros or pass missing methods to the store.
Parameters
- $method string
- $parameters array
__clone ( ) : void
Clone cache repository instance.