PHP Class Nette\Caching\Cache

Author: David Grudl
Inheritance: extends Nette\Object, implements ArrayAccess
Afficher le fichier Open project: nette/caching Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( Nette\Caching\IStorage $storage, $namespace = NULL )
bulkLoad ( array $keys, $fallback = NULL ) : array Reads multiple items from the cache.
call ( $function ) : mixed Caches results of function/method calls.
checkCallbacks ( $callbacks ) : boolean Checks CALLBACKS dependencies.
clean ( array $conditions = NULL ) : void Removes items from the cache by conditions.
derive ( $namespace ) : self Returns new nested cache object.
getNamespace ( ) : string Returns cache namespace.
getStorage ( ) : Nette\Caching\IStorage Returns cache storage.
load ( $key, $fallback = NULL ) : mixed | null Reads the specified item from the cache or generate it.
remove ( $key ) : void Removes item from the cache.
save ( $key, $data, array $dependencies = NULL ) : mixed Writes item into the cache.
start ( $key ) : OutputHelper | null Starts the output cache.
wrap ( $function, array $dependencies = NULL ) : Closure Caches results of function/method calls.

Méthodes protégées

Méthode Description
generateKey ( $key ) : string Generates internal cache key.

Private Methods

Méthode Description
checkConst ( $const, $value ) : boolean Checks CONSTS dependency.
checkFile ( $file, $time ) : boolean Checks FILES dependency.
completeDependencies ( $dp )

Method Details

__construct() public méthode

public __construct ( Nette\Caching\IStorage $storage, $namespace = NULL )
$storage Nette\Caching\IStorage

bulkLoad() public méthode

Reads multiple items from the cache.
public bulkLoad ( array $keys, $fallback = NULL ) : array
$keys array
Résultat array

call() public méthode

Caches results of function/method calls.
public call ( $function ) : mixed
Résultat mixed

checkCallbacks() public static méthode

Checks CALLBACKS dependencies.
public static checkCallbacks ( $callbacks ) : boolean
Résultat boolean

clean() public méthode

Conditions are: - Cache::PRIORITY => (int) priority - Cache::TAGS => (array) tags - Cache::ALL => TRUE
public clean ( array $conditions = NULL ) : void
$conditions array
Résultat void

derive() public méthode

Returns new nested cache object.
public derive ( $namespace ) : self
Résultat self

generateKey() protected méthode

Generates internal cache key.
protected generateKey ( $key ) : string
Résultat string

getNamespace() public méthode

Returns cache namespace.
public getNamespace ( ) : string
Résultat string

getStorage() public méthode

Returns cache storage.
public getStorage ( ) : Nette\Caching\IStorage
Résultat Nette\Caching\IStorage

load() public méthode

Reads the specified item from the cache or generate it.
public load ( $key, $fallback = NULL ) : mixed | null
Résultat mixed | null

remove() public méthode

Removes item from the cache.
public remove ( $key ) : void
Résultat void

save() public méthode

Dependencies are: - Cache::PRIORITY => (int) priority - Cache::EXPIRATION => (timestamp) expiration - Cache::SLIDING => (bool) use sliding expiration? - Cache::TAGS => (array) tags - Cache::FILES => (array|string) file names - Cache::ITEMS => (array|string) cache items - Cache::CONSTS => (array|string) cache items
public save ( $key, $data, array $dependencies = NULL ) : mixed
$dependencies array
Résultat mixed value itself

start() public méthode

Starts the output cache.
public start ( $key ) : OutputHelper | null
Résultat OutputHelper | null

wrap() public méthode

Caches results of function/method calls.
public wrap ( $function, array $dependencies = NULL ) : Closure
$dependencies array
Résultat Closure