class Illuminate / Cache / Repository
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

Repository

Implements

Uses

Properties

protected

$store Store

The cache store implementation.

Default: null
protected

$events Dispatcher

The event dispatcher implementation.

Default: null
protected

$default int|null

The default number of seconds to store items.

Default: 3600

Methods

public

__construct ( Store $store ) : void

Create a new cache repository instance.

Parameters

public

has ( $key ) : bool

Determine if an item exists in the cache.

Parameters

  • $key array|string
public

missing ( $key ) : bool

Determine if an item doesn't exist in the cache.

Parameters

  • $key string
public

get ( $key , $default ) : mixed

Retrieve an item from the cache by key.

Parameters

  • $key array|string
  • $default TCacheValue|callable
public

many ( array $keys ) : array

Retrieve multiple items from the cache by key.

Parameters

  • $keys array
public

getMultiple ( $keys , $default ) : iterable

{@inheritdoc}

protected

handleManyResult ( $keys , $key , $value ) : mixed

Handle a result for the "many" method.

Parameters

  • $keys array
  • $key string
  • $value mixed
public

pull ( $key , $default ) : mixed

Retrieve an item from the cache and delete it.

Parameters

  • $key array|string
  • $default TCacheValue|callable
public

put ( $key , $value , $ttl ) : bool

Store an item in the cache.

Parameters

public

set ( $key , $value , $ttl ) : bool

{@inheritdoc}

public

putMany ( array $values , $ttl ) : bool

Store multiple items in the cache for a given number of seconds.

Parameters

protected

putManyForever ( array $values ) : bool

Store multiple items in the cache indefinitely.

Parameters

  • $values array
public

setMultiple ( $values , $ttl ) : bool

{@inheritdoc}

public

add ( $key , $value , $ttl ) : bool

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

Parameters

public

increment ( $key , $value ) : int|bool

Increment the value of an item in the cache.

Parameters

  • $key string
  • $value mixed
public

decrement ( $key , $value ) : int|bool

Decrement the value of an item in the cache.

Parameters

  • $key string
  • $value mixed
public

forever ( $key , $value ) : bool

Store an item in the cache indefinitely.

Parameters

  • $key string
  • $value mixed
public

remember ( $key , $ttl , Closure $callback ) : TCacheValue

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

Parameters

public

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
public

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
public

forget ( $key ) : bool

Remove an item from the cache.

Parameters

  • $key string
public

delete ( $key ) : bool

{@inheritdoc}

public

deleteMultiple ( $keys ) : bool

{@inheritdoc}

public

clear ( ) : bool

{@inheritdoc}

public

tags ( $names ) : TaggedCache

Begin executing a new tags operation if the store supports it.

Parameters

  • $names array|mixed
protected

itemKey ( $key ) : string

Format the key for a cache item.

Parameters

  • $key string
protected

getSeconds ( $ttl ) : int

Calculate the number of seconds for the given TTL.

Parameters

public

supportsTags ( ) : bool

Determine if the current store supports tags.

public

getDefaultCacheTime ( ) : int|null

Get the default cache time.

public

setDefaultCacheTime ( $seconds ) : $this

Set the default cache time in seconds.

Parameters

  • $seconds int|null
public

getStore ( ) : Store

Get the cache store implementation.

public

setStore ( $store ) : static

Set the cache store implementation.

Parameters

protected

event ( $event ) : void

Fire an event for this cache instance.

Parameters

  • $event object|string
public

getEventDispatcher ( ) : Dispatcher

Get the event dispatcher instance.

public

setEventDispatcher ( Dispatcher $events ) : void

Set the event dispatcher instance.

Parameters

public

offsetExists ( $key ) : bool

Determine if a cached value exists.

Parameters

  • $key string
public

offsetGet ( $key ) : mixed

Retrieve an item from the cache by key.

Parameters

  • $key string
public

offsetSet ( $key , $value ) : void

Store an item in the cache for the default time.

Parameters

  • $key string
  • $value mixed
public

offsetUnset ( $key ) : void

Remove an item from the cache.

Parameters

  • $key string
public

__call ( $method , $parameters ) : mixed

Handle dynamic calls into macros or pass missing methods to the store.

Parameters

  • $method string
  • $parameters array
public

__clone ( ) : void

Clone cache repository instance.