PHP Class Nette\Caching\Cache

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

Public Methods

Method 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.

Protected Methods

Method Description
generateKey ( $key ) : string Generates internal cache key.

Private Methods

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

Method Details

__construct() public method

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

bulkLoad() public method

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

call() public method

Caches results of function/method calls.
public call ( $function ) : mixed
return mixed

checkCallbacks() public static method

Checks CALLBACKS dependencies.
public static checkCallbacks ( $callbacks ) : boolean
return boolean

clean() public method

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

derive() public method

Returns new nested cache object.
public derive ( $namespace ) : self
return self

generateKey() protected method

Generates internal cache key.
protected generateKey ( $key ) : string
return string

getNamespace() public method

Returns cache namespace.
public getNamespace ( ) : string
return string

getStorage() public method

Returns cache storage.
public getStorage ( ) : Nette\Caching\IStorage
return Nette\Caching\IStorage

load() public method

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

remove() public method

Removes item from the cache.
public remove ( $key ) : void
return void

save() public method

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
return mixed value itself

start() public method

Starts the output cache.
public start ( $key ) : OutputHelper | null
return OutputHelper | null

wrap() public method

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