PHP Class Metaphore\Cache

Afficher le fichier Open project: sobstel/metaphore Class Usage Examples

Protected Properties

Свойство Type Description
$lockManager * @var \Metaphore\LockManager
$onNoStaleCacheCallable * @var callable
$valueStore * @var \Metaphore\Store\ValueStoreInterface

Méthodes publiques

Méthode Description
__construct ( Metaphore\Store\ValueStoreInterface $valueStore, LockManager $lockManager = null )
cache ( $key, callable $cachedCallable, $ttl, callable $onNoStaleCacheCallable = null ) Caches specified closure/method/function for specified time.
delete ( $key ) : boolean
getLockManager ( ) : LockManager
getValue ( $key ) : Value
getValueStore ( ) : Metaphore\Store\ValueStoreInterface
onNoStaleCache ( callable $onNoStaleCacheCallable )
setResult ( $key, $result, $ttl ) Sets result. Does not use anti-dogpile-effect mechanism. Use cache() instead for this.

Method Details

__construct() public méthode

public __construct ( Metaphore\Store\ValueStoreInterface $valueStore, LockManager $lockManager = null )
$valueStore Metaphore\Store\ValueStoreInterface
$lockManager LockManager

cache() public méthode

As a third argument - instead of integer - you can pass Ttt object to define grace tll and lock ttl (both optional).
public cache ( $key, callable $cachedCallable, $ttl, callable $onNoStaleCacheCallable = null )
$cachedCallable callable
$onNoStaleCacheCallable callable

delete() public méthode

public delete ( $key ) : boolean
Résultat boolean

getLockManager() public méthode

public getLockManager ( ) : LockManager
Résultat LockManager

getValue() public méthode

public getValue ( $key ) : Value
Résultat Value

getValueStore() public méthode

public getValueStore ( ) : Metaphore\Store\ValueStoreInterface
Résultat Metaphore\Store\ValueStoreInterface

onNoStaleCache() public méthode

public onNoStaleCache ( callable $onNoStaleCacheCallable )
$onNoStaleCacheCallable callable

setResult() public méthode

Sets result. Does not use anti-dogpile-effect mechanism. Use cache() instead for this.
public setResult ( $key, $result, $ttl )

Property Details

$lockManager protected_oe property

* @var \Metaphore\LockManager
protected $lockManager

$onNoStaleCacheCallable protected_oe property

* @var callable
protected $onNoStaleCacheCallable

$valueStore protected_oe property

* @var \Metaphore\Store\ValueStoreInterface
protected $valueStore