Packages

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • none

Classes

Interfaces

  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage

Class Cache

Implements the cache for a application.

Object
Extended by Cache implements ArrayAccess
Package: Nette\Caching
Author: David Grudl
Located at Caching/Cache.php
Methods summary
public
# __construct( ICacheStorage $storage, $namespace = NULL )
public ICacheStorage
# getStorage( )

Returns cache storage.

Returns cache storage.

Returns

ICacheStorage
public string
# getNamespace( )

Returns cache namespace.

Returns cache namespace.

Returns

string
public Cache
# derive( string $namespace )

Returns new nested cache object.

Returns new nested cache object.

Parameters

$namespace
string

Returns

Cache
public mixed|null
# load( mixed $key, callable $fallback = NULL )

Reads the specified item from the cache or generate it.

Reads the specified item from the cache or generate it.

Parameters

$key
mixed
key
$fallback
callable

Returns

mixed|null
public mixed
# save( mixed $key, mixed $data, array $dependencies = NULL )

Writes item into the cache. 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

Writes item into the cache. 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

Parameters

$key
mixed
key
$data
mixed
value
$dependencies
array
dependencies

Returns

mixed
value itself

Throws

InvalidArgumentException
public
# remove( mixed $key )

Removes item from the cache.

Removes item from the cache.

Parameters

$key
mixed
key
public
# clean( array $conditions = NULL )

Removes items from the cache by conditions. Conditions are:

  • Cache::PRIORITY => (int) priority
  • Cache::TAGS => (array) tags
  • Cache::ALL => TRUE

Removes items from the cache by conditions. Conditions are:

  • Cache::PRIORITY => (int) priority
  • Cache::TAGS => (array) tags
  • Cache::ALL => TRUE
public mixed
# call( mixed $function )

Caches results of function/method calls.

Caches results of function/method calls.

Parameters

$function
mixed

Returns

mixed
public Closure
# wrap( mixed $function, array $dependencies = NULL )

Caches results of function/method calls.

Caches results of function/method calls.

Parameters

$function
mixed
$dependencies
array
dependencies

Returns

Closure
public CachingHelper|null
# start( mixed $key )

Starts the output cache.

Starts the output cache.

Parameters

$key
mixed
key

Returns

CachingHelper|null
protected string
# generateKey( string $key )

Generates internal cache key.

Generates internal cache key.

Parameters

$key
string

Returns

string
public
# offsetSet( mixed $key, mixed $data )

Inserts (replaces) item into the cache (ArrayAccess implementation).

Inserts (replaces) item into the cache (ArrayAccess implementation).

Parameters

$key
mixed
key
$data
mixed

Throws

InvalidArgumentException

Implementation of

ArrayAccess::offsetSet()
public mixed|null
# offsetGet( mixed $key )

Retrieves the specified item from the cache or NULL if the key is not found (ArrayAccess implementation).

Retrieves the specified item from the cache or NULL if the key is not found (ArrayAccess implementation).

Parameters

$key
mixed
key

Returns

mixed|null

Throws

InvalidArgumentException

Implementation of

ArrayAccess::offsetGet()
public boolean
# offsetExists( mixed $key )

Exists item in cache? (ArrayAccess implementation).

Exists item in cache? (ArrayAccess implementation).

Parameters

$key
mixed
key

Returns

boolean

Throws

InvalidArgumentException

Implementation of

ArrayAccess::offsetExists()
public
# offsetUnset( mixed $key )

Removes the specified item from the cache.

Removes the specified item from the cache.

Parameters

$key
mixed
key

Throws

InvalidArgumentException

Implementation of

ArrayAccess::offsetUnset()
public
# release( )

Discards the internal cache used by ArrayAccess.

Discards the internal cache used by ArrayAccess.

public static boolean
# checkCallbacks( array $callbacks )

Checks CALLBACKS dependencies.

Checks CALLBACKS dependencies.

Parameters

$callbacks
array

Returns

boolean
Methods inherited from Object
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Constants summary
string PRIORITY 'priority'
#

dependency

dependency

string EXPIRATION 'expire'
#

dependency

dependency

string EXPIRE 'expire'
#

dependency

dependency

string SLIDING 'sliding'
#

dependency

dependency

string TAGS 'tags'
#

dependency

dependency

string FILES 'files'
#

dependency

dependency

string ITEMS 'items'
#

dependency

dependency

string CONSTS 'consts'
#

dependency

dependency

string CALLBACKS 'callbacks'
#

dependency

dependency

string ALL 'all'
#

dependency

dependency

Magic properties summary
public read-only ICacheStorage $storage
#
public read-only string $namespace
#
Magic properties inherited from Object
$reflection
Nette Framework 2.0.18 (for PHP 5.2, un-prefixed) API documentation generated by ApiGen 2.8.0