PHP Class Webiny\Component\Cache\Bridge\Memory\APC

Inheritance: extends Jamm\Memory\APCObject, implements Webiny\Component\Cache\Bridge\CacheStorageInterface
Show file Open project: Webiny/Framework

Public Methods

Method Description
__construct ( ) Constructor.
acquireKey ( string $key, &$autoUnlocker ) : boolean Try to lock key, and if key is already locked - wait, until key will be unlocked.
delete ( string | array $key ) : boolean | array Delete key or array of keys from storage.
deleteByTags ( array | string $tag ) : boolean Delete keys by tags.
deleteOld ( ) : boolean Delete expired cache values.
lockKey ( mixed $key, mixed &$autoUnlockerVariable ) : boolean Get exclusive mutex for key. Key will be still accessible to read and write, but another process can exclude dog-pile effect, if before updating the key he will try to get this mutex.
selectByCallback ( callable $callback, boolean $getArray = false ) : mixed Select from storage via callback function.

Method Details

__construct() public method

Constructor.
public __construct ( )

acquireKey() public method

Time of waiting is defined in max_wait_unlock constant of MemoryObject class.
public acquireKey ( string $key, &$autoUnlocker ) : boolean
$key string Name of the cache key.
$autoUnlocker
return boolean

delete() public method

Delete key or array of keys from storage.
public delete ( string | array $key ) : boolean | array
$key string | array Key, or array of keys, you wish to delete.
return boolean | array If array of keys was passed, on error will be returned array of not deleted keys, or true on success.

deleteByTags() public method

Delete keys by tags.
public deleteByTags ( array | string $tag ) : boolean
$tag array | string Tag, or an array of tags, for which you wish to delete the cache.
return boolean

deleteOld() public method

Delete expired cache values.
public deleteOld ( ) : boolean
return boolean

lockKey() public method

Get exclusive mutex for key. Key will be still accessible to read and write, but another process can exclude dog-pile effect, if before updating the key he will try to get this mutex.
public lockKey ( mixed $key, mixed &$autoUnlockerVariable ) : boolean
$key mixed Name of the cache key.
$autoUnlockerVariable mixed Pass empty, just declared variable
return boolean

selectByCallback() public method

Only values of array type will be selected.
public selectByCallback ( callable $callback, boolean $getArray = false ) : mixed
$callback callable ($value_array,$key)
$getArray boolean
return mixed