PHP Класс Stash\Item

Автор: Robert Hafner ([email protected])
Наследование: implements Stash\Interfaces\ItemInterface
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$cacheTime This is the default time, in seconds, that objects are cached for.
$runtimeDisable boolean Disables the cache system wide. It is used internally when the storage engine fails or if the cache is being cleared. This differs from the cacheEnabled property in that it affects all instances of the cache, not just one.

Защищенные свойства (Protected)

Свойство Тип Описание
$cacheEnabled boolean Used internally to mark the class as disabled. Unlike the static runtimeDisable flag this is effective only for the current instance.
$data
$defaults array Contains a list of default arguments for when users do not supply them.
$driver Stash\Interfaces\DriverInterface The cacheDriver being used by the system. While this class handles all of the higher functions, it's the cache driver here that handles all of the storage/retrieval functionality. This value is set by the constructor.
$expiration
$invalidationArg1
$invalidationArg2
$invalidationMethod
$key The identifier for the item being cached. It is set through the setupKey function.
$keyString string A serialized version of the key, used primarily used as the index in various arrays.
$logger Psr\Log\LoggerInterface If set various then errors and exceptions will get passed to the PSR Compliant logging library. This can be set using the setLogger() function in this class.
$namespace string | null Defines the namespace the item lives in.
$pool Stash\Interfaces\PoolInterface .
$stampedeRunning boolean Marks whether or not stampede protection is enabled for this instance of Stash.

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

Метод Описание
__destruct ( ) This clears out any locks that are present if this Item is prematurely destructed.
clear ( )
disable ( )
expiresAfter ( $time )
expiresAt ( $expiration = null )
extend ( $ttl = null )
get ( )
getCreation ( )
getExpiration ( )
getKey ( )
isDisabled ( )
isHit ( )
isMiss ( )
lock ( $ttl = null )
save ( )
set ( $value )
setInvalidationMethod ( $invalidation = Invalidation::PRECOMPUTE, $arg = null, $arg2 = null )
setKey ( array $key, $namespace = null )
setLogger ( $logger )
setPool ( Stash\Interfaces\PoolInterface $pool )
setTTL ( $ttl = null )

Защищенные методы

Метод Описание
getRecord ( ) : array Returns the record for the current key. If there is no record than an empty array is returned.
getStampedeFlag ( array $key ) : boolean Returns true if another Item is currently recalculating the cache.
logException ( string $message, Exception $exception ) : boolean Logs an exception with the Logger class, if it exists.
validateRecord ( array $validation, &$record ) Decides whether the current data is fresh according to the supplied validation technique. As some techniques actively change the record this function takes that in as a reference.

Приватные методы

Метод Описание
executeClear ( )
executeGet ( $invalidation = Invalidation::PRECOMPUTE, $arg = null, $arg2 = null )
executeSet ( $data, $time )

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

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

This clears out any locks that are present if this Item is prematurely destructed.
public __destruct ( )

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

public clear ( )

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

public disable ( )

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

public expiresAfter ( $time )

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

public expiresAt ( $expiration = null )

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

public extend ( $ttl = null )

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

public get ( )

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

public getCreation ( )

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

public getExpiration ( )

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

public getKey ( )

getRecord() защищенный Метод

Returns the record for the current key. If there is no record than an empty array is returned.
protected getRecord ( ) : array
Результат array

getStampedeFlag() защищенный Метод

Returns true if another Item is currently recalculating the cache.
protected getStampedeFlag ( array $key ) : boolean
$key array
Результат boolean

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

public isDisabled ( )

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

public isHit ( )

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

public isMiss ( )

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

public lock ( $ttl = null )

logException() защищенный Метод

Logs an exception with the Logger class, if it exists.
protected logException ( string $message, Exception $exception ) : boolean
$message string
$exception Exception
Результат boolean

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

public save ( )

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

public set ( $value )

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

public setInvalidationMethod ( $invalidation = Invalidation::PRECOMPUTE, $arg = null, $arg2 = null )

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

public setKey ( array $key, $namespace = null )
$key array

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

public setLogger ( $logger )

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

public setPool ( Stash\Interfaces\PoolInterface $pool )
$pool Stash\Interfaces\PoolInterface

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

public setTTL ( $ttl = null )

validateRecord() защищенный Метод

This function has the ability to change the isHit property as well as the record passed.
protected validateRecord ( array $validation, &$record )
$validation array

Описание свойств

$cacheEnabled защищенное свойство

Used internally to mark the class as disabled. Unlike the static runtimeDisable flag this is effective only for the current instance.
protected bool $cacheEnabled
Результат boolean

$cacheTime публичное статическое свойство

This is the default time, in seconds, that objects are cached for.
public static $cacheTime

$data защищенное свойство

protected $data

$defaults защищенное свойство

Contains a list of default arguments for when users do not supply them.
protected array $defaults
Результат array

$driver защищенное свойство

The cacheDriver being used by the system. While this class handles all of the higher functions, it's the cache driver here that handles all of the storage/retrieval functionality. This value is set by the constructor.
protected DriverInterface,Stash\Interfaces $driver
Результат Stash\Interfaces\DriverInterface

$expiration защищенное свойство

protected $expiration

$invalidationArg1 защищенное свойство

protected $invalidationArg1

$invalidationArg2 защищенное свойство

protected $invalidationArg2

$invalidationMethod защищенное свойство

protected $invalidationMethod

$key защищенное свойство

The identifier for the item being cached. It is set through the setupKey function.
protected $key

$keyString защищенное свойство

A serialized version of the key, used primarily used as the index in various arrays.
protected string $keyString
Результат string

$logger защищенное свойство

If set various then errors and exceptions will get passed to the PSR Compliant logging library. This can be set using the setLogger() function in this class.
protected LoggerInterface,Psr\Log $logger
Результат Psr\Log\LoggerInterface

$namespace защищенное свойство

Defines the namespace the item lives in.
protected string|null $namespace
Результат string | null

$pool защищенное свойство

.
protected PoolInterface,Stash\Interfaces $pool
Результат Stash\Interfaces\PoolInterface

$runtimeDisable публичное статическое свойство

Disables the cache system wide. It is used internally when the storage engine fails or if the cache is being cleared. This differs from the cacheEnabled property in that it affects all instances of the cache, not just one.
public static bool $runtimeDisable
Результат boolean

$stampedeRunning защищенное свойство

Marks whether or not stampede protection is enabled for this instance of Stash.
protected bool $stampedeRunning
Результат boolean