PHP 클래스 Webiny\Component\Cache\Storage\BlackHole

This storage is used when cache status is set to false.
상속: implements Webiny\Component\Cache\Bridge\CacheStorageInterface
파일 보기 프로젝트 열기: Webiny/Framework

공개 메소드들

메소드 설명
acquireKey ( string $key, &$autoUnlocker ) : boolean Try to lock key, and if key is already locked - wait, until key will be unlocked.
add ( string $key, mixed $value, integer $ttl = 600, array | string $tags = null ) : boolean Save a value into memory only if it DOESN'T exists (or false will be returned).
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.
increment ( string $key, mixed $byValue = 1, integer $limitKeysCount, integer $ttl = 259200 ) : integer | string | array Increment value of the key.
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.
read ( string | array $key, mixed &$ttlLeft ) : mixed Get the cache data for the given $key.
save ( string $key, mixed $value, integer $ttl = 600, array | string $tags = null ) : boolean Save a value into memory.
selectByCallback ( callable $callback, boolean $getArray = false ) : mixed Select from storage via callback function.

메소드 상세

acquireKey() 공개 메소드

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
리턴 boolean

add() 공개 메소드

Save a value into memory only if it DOESN'T exists (or false will be returned).
public add ( string $key, mixed $value, integer $ttl = 600, array | string $tags = null ) : boolean
$key string Name of the key.
$value mixed Value you wish to save.
$ttl integer For how long to store value. (in seconds)
$tags array | string Tags you wish to assign to this cache entry.
리턴 boolean True if value was added, otherwise false.

delete() 공개 메소드

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.
리턴 boolean | array If array of keys was passed, on error will be returned array of not deleted keys, or true on success.

deleteByTags() 공개 메소드

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.
리턴 boolean

deleteOld() 공개 메소드

Delete expired cache values.
public deleteOld ( ) : boolean
리턴 boolean

increment() 공개 메소드

Increment value of the key.
public increment ( string $key, mixed $byValue = 1, integer $limitKeysCount, integer $ttl = 259200 ) : integer | string | array
$key string Name of the cache key.
$byValue mixed If stored value is an array: - If $by_value is a value in array, new element will be pushed to the end of array, - If $by_value is a key=>value array, new key=>value pair will be added (or updated).
$limitKeysCount integer Maximum count of elements (used only if stored value is array).
$ttl integer Set time to live for key.
리턴 integer | string | array New key value.

lockKey() 공개 메소드

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
리턴 boolean

read() 공개 메소드

Get the cache data for the given $key.
public read ( string | array $key, mixed &$ttlLeft ) : mixed
$key string | array Name of the cache key.
$ttlLeft mixed = (ttl - time()) of key. Use to exclude dog-pile effect, with lock/unlock_key methods.
리턴 mixed

save() 공개 메소드

Save a value into memory.
public save ( string $key, mixed $value, integer $ttl = 600, array | string $tags = null ) : boolean
$key string Name of the key.
$value mixed Value you wish to save.
$ttl integer For how long to store value. (in seconds)
$tags array | string Tags you wish to assign to this cache entry.
리턴 boolean True if value was stored successfully, otherwise false.

selectByCallback() 공개 메소드

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