PHP 클래스 Cachearium\CacheData

파일 보기 프로젝트 열기: corollarium/cachearium 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$data array The actual cached data
$dependencies array:CacheKey This is a storage of dependencies for this cache. This is stored here as the russian doll model will automatically push up dependencies. In the end this will probably be used by the storage for easy invalidation.
$key CacheKey
$lifetime integer Lifetime: how long this cache should live. It's up to the storage implementation the details of how this will be obeyed, if at all.

공개 메소드들

메소드 설명
__construct ( CacheKey $ck, $data = null )
addDependencies ( array $deps ) : CacheData Adds a dependency
addDependency ( CacheKey $k ) : CacheData Adds a dependency
appendCallback ( callable $callback ) : CacheData
appendData ( mixed $data ) : CacheData
appendRecursion ( CacheKey $k )
appendRecursionData ( CacheData $d )
checkClash ( CacheKey $k ) : boolean Checks if a set of keys clashes with the ones used here.
checkUpdateToDate ( CacheAbstract $cache ) : boolean Checks if dependencies are still fresh.
clearDependenciesHash ( )
dependencyInit ( CacheAbstract $cache, CacheKey $k ) : integer Init dependencies. If increment is not supported by backend return 0.
generateDependenciesHash ( CacheAbstract $cache ) : string Get a fresh hash based on dependencies. Does not update the current hash.
getDependencies ( )
getDependenciesHash ( )
getFirstData ( ) : any | null Convenience function. Returns the first data self::CACHEDATA_TYPE_DATA that you stored. Returns null if there is none.
getKey ( )
mergeDependencies ( CacheData $cd ) : CacheData
serialize ( ) : string Serialize this object to a string so we can easily store.
setDependencies ( array $deps, CacheAbstract $cache ) : CacheData Sets the list of dependencies and updates the dependency hash
setKey ( CacheKey $ck ) : CacheData
setLifetime ( integer $lifetime ) : CacheData
stringify ( CacheAbstract $c, $recurse = true ) Converts this data to a string that can output. This is not a hash key or a serialization, but an actual render for humans.
unserialize ( string $data ) : CacheData Unserializes data and returns a new CacheData. This is what you should use to get the object data from the storage.
updateDependenciesHash ( CacheAbstract $cache )
updateDependenciesHashIfNull ( CacheAbstract $cache )

메소드 상세

__construct() 공개 메소드

public __construct ( CacheKey $ck, $data = null )
$ck CacheKey

addDependencies() 공개 메소드

Adds a dependency
public addDependencies ( array $deps ) : CacheData
$deps array
리턴 CacheData This

addDependency() 공개 메소드

Adds a dependency
public addDependency ( CacheKey $k ) : CacheData
$k CacheKey
리턴 CacheData This

appendCallback() 공개 메소드

public appendCallback ( callable $callback ) : CacheData
$callback callable
리턴 CacheData

appendData() 공개 메소드

public appendData ( mixed $data ) : CacheData
$data mixed Any kind of data you want to store. usually strings.
리턴 CacheData

appendRecursion() 공개 메소드

public appendRecursion ( CacheKey $k )
$k CacheKey

appendRecursionData() 공개 메소드

public appendRecursionData ( CacheData $d )
$d CacheData

checkClash() 공개 메소드

Checks if a set of keys clashes with the ones used here.
public checkClash ( CacheKey $k ) : boolean
$k CacheKey
리턴 boolean True if they match and there is a clash

checkUpdateToDate() 공개 메소드

Checks if dependencies are still fresh.
public checkUpdateToDate ( CacheAbstract $cache ) : boolean
$cache CacheAbstract
리턴 boolean

clearDependenciesHash() 공개 메소드

dependencyInit() 공개 메소드

Init dependencies. If increment is not supported by backend return 0.
public dependencyInit ( CacheAbstract $cache, CacheKey $k ) : integer
$cache CacheAbstract
$k CacheKey
리턴 integer

generateDependenciesHash() 공개 메소드

Get a fresh hash based on dependencies. Does not update the current hash.
public generateDependenciesHash ( CacheAbstract $cache ) : string
$cache CacheAbstract
리턴 string

getDependencies() 공개 메소드

public getDependencies ( )

getDependenciesHash() 공개 메소드

public getDependenciesHash ( )

getFirstData() 공개 메소드

Convenience function. Returns the first data self::CACHEDATA_TYPE_DATA that you stored. Returns null if there is none.
public getFirstData ( ) : any | null
리턴 any | null

getKey() 공개 메소드

public getKey ( )

mergeDependencies() 공개 메소드

public mergeDependencies ( CacheData $cd ) : CacheData
$cd CacheData
리턴 CacheData

serialize() 공개 메소드

Serialize this object to a string so we can easily store.
public serialize ( ) : string
리턴 string

setDependencies() 공개 메소드

Sets the list of dependencies and updates the dependency hash
public setDependencies ( array $deps, CacheAbstract $cache ) : CacheData
$deps array
$cache CacheAbstract
리턴 CacheData

setKey() 공개 메소드

public setKey ( CacheKey $ck ) : CacheData
$ck CacheKey
리턴 CacheData

setLifetime() 공개 메소드

public setLifetime ( integer $lifetime ) : CacheData
$lifetime integer
리턴 CacheData

stringify() 공개 메소드

Converts this data to a string that can output. This is not a hash key or a serialization, but an actual render for humans.
public stringify ( CacheAbstract $c, $recurse = true )
$c CacheAbstract

unserialize() 공개 정적인 메소드

Unserializes data and returns a new CacheData. This is what you should use to get the object data from the storage.
public static unserialize ( string $data ) : CacheData
$data string
리턴 CacheData

updateDependenciesHash() 공개 메소드

public updateDependenciesHash ( CacheAbstract $cache )
$cache CacheAbstract

updateDependenciesHashIfNull() 공개 메소드

public updateDependenciesHashIfNull ( CacheAbstract $cache )
$cache CacheAbstract

프로퍼티 상세

$data 공개적으로 프로퍼티

The actual cached data
public array $data
리턴 array

$dependencies 공개적으로 프로퍼티

This is a storage of dependencies for this cache. This is stored here as the russian doll model will automatically push up dependencies. In the end this will probably be used by the storage for easy invalidation.
public array:CacheKey $dependencies
리턴 array:CacheKey

$key 공개적으로 프로퍼티

public CacheKey,cachearium $key
리턴 CacheKey

$lifetime 공개적으로 프로퍼티

Lifetime: how long this cache should live. It's up to the storage implementation the details of how this will be obeyed, if at all.
public int $lifetime
리턴 integer