PHP Interface Stash\Interfaces\ItemInterface

Inheritance: extends Psr\Cache\CacheItemInterface
Afficher le fichier Open project: tedivm/stash Interface Usage Examples

Méthodes publiques

Méthode Description
clear ( ) : boolean Clears the current Item. If hierarchical or "stackable" caching is being used this function will also remove children Items.
disable ( ) : boolean This disables any IO operations by this object, effectively preventing the reading and writing of new data.
expiresAfter ( integer | DateInterval $time ) : self Sets the expiration based off of an integer or DateInterval
expiresAt ( DateTimeInterface $expiration ) : self Sets the expiration to a specific time.
extend ( null $ttl = null ) : boolean Extends the expiration on the current cached item. For some engines this can be faster than storing the item again.
get ( ) : mixed Returns the data retrieved from the cache. Since this can return false or null as a correctly cached value, the return value should not be used to determine successful retrieval of data- for that use the "isMiss()" function after call this one. If no value is stored at all then this function will return null.
getCreation ( ) : DateTime Returns the record's creation time or false if it isn't set
getExpiration ( ) : DateTime Returns the record's expiration timestamp or false if no expiration timestamp is set
getKey ( ) : string Returns the key as a string. This is particularly useful when the Item is returned as a group of Items in an Iterator.
isDisabled ( ) : boolean Return true if caching is disabled
isHit ( ) : boolean Returns true if the cached item is valid and usable.
isMiss ( ) : boolean Returns true if the cached item needs to be refreshed.
lock ( null $ttl = null ) : boolean Enables stampede protection by marking this specific instance of the Item as the one regenerating the cache.
save ( ) : boolean Persists the Item's value to the backend storage.
set ( mixed $value ) : self Takes and stores data for later retrieval. This data can be any php data, including arrays and object, except resources and objects which are unable to be serialized.
setInvalidationMethod ( integer $invalidation, mixed $arg = null, mixed $arg2 = null ) Set the cache invalidation method for this item.
setKey ( array $key, string | null $namespace = null ) Takes and sets the key and namespace.
setLogger ( PSR\Log\LoggerInterface $logger ) : boolean Sets a PSR\Logger style logging client to enable the tracking of errors.
setPool ( Stash\Interfaces\PoolInterface $driver ) Sets the Parent Pool for the Item class to use.
setTTL ( mixed $ttl = null ) : self Sets the expiration based off a an integer, date interval, or date

Method Details

clear() public méthode

Clears the current Item. If hierarchical or "stackable" caching is being used this function will also remove children Items.
public clear ( ) : boolean
Résultat boolean

disable() public méthode

This disables any IO operations by this object, effectively preventing the reading and writing of new data.
public disable ( ) : boolean
Résultat boolean

expiresAfter() public méthode

Sets the expiration based off of an integer or DateInterval
public expiresAfter ( integer | DateInterval $time ) : self
$time integer | DateInterval
Résultat self

expiresAt() public méthode

Sets the expiration to a specific time.
public expiresAt ( DateTimeInterface $expiration ) : self
$expiration DateTimeInterface
Résultat self

extend() public méthode

Extends the expiration on the current cached item. For some engines this can be faster than storing the item again.
public extend ( null $ttl = null ) : boolean
$ttl null
Résultat boolean

get() public méthode

Returns the data retrieved from the cache. Since this can return false or null as a correctly cached value, the return value should not be used to determine successful retrieval of data- for that use the "isMiss()" function after call this one. If no value is stored at all then this function will return null.
public get ( ) : mixed
Résultat mixed

getCreation() public méthode

Returns the record's creation time or false if it isn't set
public getCreation ( ) : DateTime
Résultat DateTime

getExpiration() public méthode

Returns the record's expiration timestamp or false if no expiration timestamp is set
public getExpiration ( ) : DateTime
Résultat DateTime

getKey() public méthode

Returns the key as a string. This is particularly useful when the Item is returned as a group of Items in an Iterator.
public getKey ( ) : string
Résultat string

isDisabled() public méthode

Return true if caching is disabled
public isDisabled ( ) : boolean
Résultat boolean True if caching is disabled.

isHit() public méthode

Returns true if the cached item is valid and usable.
public isHit ( ) : boolean
Résultat boolean

isMiss() public méthode

Returns true if the cached item needs to be refreshed.
public isMiss ( ) : boolean
Résultat boolean

lock() public méthode

Enables stampede protection by marking this specific instance of the Item as the one regenerating the cache.
public lock ( null $ttl = null ) : boolean
$ttl null
Résultat boolean

save() public méthode

Persists the Item's value to the backend storage.
public save ( ) : boolean
Résultat boolean

set() public méthode

Takes and stores data for later retrieval. This data can be any php data, including arrays and object, except resources and objects which are unable to be serialized.
public set ( mixed $value ) : self
$value mixed bool
Résultat self

setInvalidationMethod() public méthode

Set the cache invalidation method for this item.
See also: Stash\Invalidation
public setInvalidationMethod ( integer $invalidation, mixed $arg = null, mixed $arg2 = null )
$invalidation integer A Stash\Invalidation constant
$arg mixed First argument for invalidation method
$arg2 mixed Second argument for invalidation method

setKey() public méthode

Typically called by Pool directly, and *must* be called before running caching functions.
public setKey ( array $key, string | null $namespace = null )
$key array
$namespace string | null

setLogger() public méthode

Sets a PSR\Logger style logging client to enable the tracking of errors.
public setLogger ( PSR\Log\LoggerInterface $logger ) : boolean
$logger PSR\Log\LoggerInterface
Résultat boolean

setPool() public méthode

Typically called by Pool directly, and *must* be called before running caching functions.
public setPool ( Stash\Interfaces\PoolInterface $driver )
$driver Stash\Interfaces\PoolInterface

setTTL() public méthode

Sets the expiration based off a an integer, date interval, or date
public setTTL ( mixed $ttl = null ) : self
$ttl mixed An integer, date interval, or date
Résultat self