\Guzzle\CacheClosureCacheAdapter

Cache adapter that defers to closures for implementation

Summary

Methods
Properties
Constants
__construct()
contains()
delete()
fetch()
save()
No public properties found
No constants found
No protected methods found
$callables
N/A
No private methods found
No private properties found
N/A

Properties

$callables

$callables : array

Type

array — Mapping of method names to callables

Methods

__construct()

__construct(array  $callables) 

The callables array is an array mapping the actions of the cache adapter to callables.

  • contains: Callable that accepts an $id and $options argument
  • delete: Callable that accepts an $id and $options argument
  • fetch: Callable that accepts an $id and $options argument
  • save: Callable that accepts an $id, $data, $lifeTime, and $options argument

Parameters

array $callables

array of action names to callable

Throws

\InvalidArgumentException

if the callable is not callable

contains()

contains(string  $id, array  $options = null) : boolean

Test if an entry exists in the cache.

Parameters

string $id

cache id The cache id of the entry to check for.

array $options

Array of cache adapter options

Returns

boolean —

Returns TRUE if a cache entry exists for the given cache id, FALSE otherwise.

delete()

delete(string  $id, array  $options = null) : boolean

Deletes a cache entry.

Parameters

string $id

cache id

array $options

Array of cache adapter options

Returns

boolean —

TRUE on success, FALSE on failure

fetch()

fetch(string  $id, array  $options = null) : string

Fetches an entry from the cache.

Parameters

string $id

cache id The id of the cache entry to fetch.

array $options

Array of cache adapter options

Returns

string —

The cached data or FALSE, if no cache entry exists for the given id.

save()

save(string  $id, string  $data, integer|boolean  $lifeTime = false, array  $options = null) : boolean

Puts data into the cache.

Parameters

string $id

The cache id

string $data

The cache entry/data

integer|boolean $lifeTime

The lifetime. If != false, sets a specific lifetime for this cache entry

array $options

Array of cache adapter options

Returns

boolean —

TRUE if the entry was successfully stored in the cache, FALSE otherwise.