PHP Class Cachearium\CacheData

Afficher le fichier Open project: corollarium/cachearium Class Usage Examples

Méthodes publiques

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
__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 )

Method Details

__construct() public méthode

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

addDependencies() public méthode

Adds a dependency
public addDependencies ( array $deps ) : CacheData
$deps array
Résultat CacheData This

addDependency() public méthode

Adds a dependency
public addDependency ( CacheKey $k ) : CacheData
$k CacheKey
Résultat CacheData This

appendCallback() public méthode

public appendCallback ( callable $callback ) : CacheData
$callback callable
Résultat CacheData

appendData() public méthode

public appendData ( mixed $data ) : CacheData
$data mixed Any kind of data you want to store. usually strings.
Résultat CacheData

appendRecursion() public méthode

public appendRecursion ( CacheKey $k )
$k CacheKey

appendRecursionData() public méthode

public appendRecursionData ( CacheData $d )
$d CacheData

checkClash() public méthode

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

checkUpdateToDate() public méthode

Checks if dependencies are still fresh.
public checkUpdateToDate ( CacheAbstract $cache ) : boolean
$cache CacheAbstract
Résultat boolean

clearDependenciesHash() public méthode

dependencyInit() public méthode

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

generateDependenciesHash() public méthode

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

getDependencies() public méthode

public getDependencies ( )

getDependenciesHash() public méthode

public getDependenciesHash ( )

getFirstData() public méthode

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

getKey() public méthode

public getKey ( )

mergeDependencies() public méthode

public mergeDependencies ( CacheData $cd ) : CacheData
$cd CacheData
Résultat CacheData

serialize() public méthode

Serialize this object to a string so we can easily store.
public serialize ( ) : string
Résultat string

setDependencies() public méthode

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

setKey() public méthode

public setKey ( CacheKey $ck ) : CacheData
$ck CacheKey
Résultat CacheData

setLifetime() public méthode

public setLifetime ( integer $lifetime ) : CacheData
$lifetime integer
Résultat CacheData

stringify() public méthode

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() public static méthode

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
Résultat CacheData

updateDependenciesHash() public méthode

public updateDependenciesHash ( CacheAbstract $cache )
$cache CacheAbstract

updateDependenciesHashIfNull() public méthode

public updateDependenciesHashIfNull ( CacheAbstract $cache )
$cache CacheAbstract

Property Details

$data public_oe property

The actual cached data
public array $data
Résultat array

$dependencies public_oe property

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
Résultat array:CacheKey

$key public_oe property

public CacheKey,cachearium $key
Résultat CacheKey

$lifetime public_oe property

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
Résultat integer