PHP Интерфейс Stash\Interfaces\ItemInterface

Наследование: extends Psr\Cache\CacheItemInterface
Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
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

Описание методов

clear() публичный Метод

Clears the current Item. If hierarchical or "stackable" caching is being used this function will also remove children Items.
public clear ( ) : boolean
Результат boolean

disable() публичный Метод

This disables any IO operations by this object, effectively preventing the reading and writing of new data.
public disable ( ) : boolean
Результат boolean

expiresAfter() публичный Метод

Sets the expiration based off of an integer or DateInterval
public expiresAfter ( integer | DateInterval $time ) : self
$time integer | DateInterval
Результат self

expiresAt() публичный Метод

Sets the expiration to a specific time.
public expiresAt ( DateTimeInterface $expiration ) : self
$expiration DateTimeInterface
Результат self

extend() публичный Метод

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
Результат boolean

get() публичный Метод

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
Результат mixed

getCreation() публичный Метод

Returns the record's creation time or false if it isn't set
public getCreation ( ) : DateTime
Результат DateTime

getExpiration() публичный Метод

Returns the record's expiration timestamp or false if no expiration timestamp is set
public getExpiration ( ) : DateTime
Результат DateTime

getKey() публичный Метод

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
Результат string

isDisabled() публичный Метод

Return true if caching is disabled
public isDisabled ( ) : boolean
Результат boolean True if caching is disabled.

isHit() публичный Метод

Returns true if the cached item is valid and usable.
public isHit ( ) : boolean
Результат boolean

isMiss() публичный Метод

Returns true if the cached item needs to be refreshed.
public isMiss ( ) : boolean
Результат boolean

lock() публичный Метод

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
Результат boolean

save() публичный Метод

Persists the Item's value to the backend storage.
public save ( ) : boolean
Результат boolean

set() публичный Метод

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
Результат self

setInvalidationMethod() публичный Метод

Set the cache invalidation method for this item.
См. также: 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() публичный Метод

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() публичный Метод

Sets a PSR\Logger style logging client to enable the tracking of errors.
public setLogger ( PSR\Log\LoggerInterface $logger ) : boolean
$logger PSR\Log\LoggerInterface
Результат boolean

setPool() публичный Метод

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

setTTL() публичный Метод

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
Результат self