Open Monograph Press  3.3.0
Guzzle\Cache\ClosureCacheAdapter Class Reference
Inheritance diagram for Guzzle\Cache\ClosureCacheAdapter:
Guzzle\Cache\CacheAdapterInterface

Public Member Functions

 __construct (array $callables)
 
 contains ($id, array $options=null)
 
 delete ($id, array $options=null)
 
 fetch ($id, array $options=null)
 
 save ($id, $data, $lifeTime=false, array $options=null)
 

Protected Attributes

 $callables
 

Detailed Description

Cache adapter that defers to closures for implementation

Definition at line 8 of file ClosureCacheAdapter.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Cache\ClosureCacheAdapter::__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$callablesarray of action names to callable
Exceptions

Definition at line 29 of file ClosureCacheAdapter.php.

References Guzzle\Cache\ClosureCacheAdapter\$callables.

Member Function Documentation

◆ contains()

Guzzle\Cache\ClosureCacheAdapter::contains (   $id,
array  $options = null 
)

Test if an entry exists in the cache.

Parameters
string$idcache id The cache id of the entry to check for.
array$optionsArray of cache adapter options
Returns
bool Returns TRUE if a cache entry exists for the given cache id, FALSE otherwise.

Implements Guzzle\Cache\CacheAdapterInterface.

Definition at line 41 of file ClosureCacheAdapter.php.

◆ delete()

Guzzle\Cache\ClosureCacheAdapter::delete (   $id,
array  $options = null 
)

Deletes a cache entry.

Parameters
string$idcache id
array$optionsArray of cache adapter options
Returns
bool TRUE on success, FALSE on failure

Implements Guzzle\Cache\CacheAdapterInterface.

Definition at line 46 of file ClosureCacheAdapter.php.

◆ fetch()

Guzzle\Cache\ClosureCacheAdapter::fetch (   $id,
array  $options = null 
)

Fetches an entry from the cache.

Parameters
string$idcache id The id of the cache entry to fetch.
array$optionsArray of cache adapter options
Returns
string The cached data or FALSE, if no cache entry exists for the given id.

Implements Guzzle\Cache\CacheAdapterInterface.

Definition at line 51 of file ClosureCacheAdapter.php.

◆ save()

Guzzle\Cache\ClosureCacheAdapter::save (   $id,
  $data,
  $lifeTime = false,
array  $options = null 
)

Puts data into the cache.

Parameters
string$idThe cache id
string$dataThe cache entry/data
int | bool$lifeTimeThe lifetime. If != false, sets a specific lifetime for this cache entry
array$optionsArray of cache adapter options
Returns
bool TRUE if the entry was successfully stored in the cache, FALSE otherwise.

Implements Guzzle\Cache\CacheAdapterInterface.

Definition at line 56 of file ClosureCacheAdapter.php.

Field Documentation

◆ $callables

array Guzzle\Cache\ClosureCacheAdapter::$callables
protected

Mapping of method names to callables

Definition at line 16 of file ClosureCacheAdapter.php.

Referenced by Guzzle\Cache\ClosureCacheAdapter\__construct().


The documentation for this class was generated from the following file: