Class Cache (namespace Nette\Caching)


Implements the cache for a application.

Object
   |
   --Cache

Implements interfaces:

ArrayAccess (internal interface)
Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Caching/Cache.php (line 33)
Public Method Summary
static bool
checkCallbacks (array $callbacks)
Checks CALLBACKS dependencies.
void
clean ([$conds = NULL])
Removes items from the cache by conditions.
Cache
__construct (ICacheStorage $storage, [$namespace = NULL])
string
Returns cache namespace.
ICacheStorage
Returns cache storage.
bool
offsetExists (string $key)
Exists item in cache? (\ArrayAccess implementation).
mixed|NULL
offsetGet (string $key)
Retrieves the specified item from the cache or NULL if the key is not found (\ArrayAccess implementation).
void
offsetSet (string $key, mixed $data)
Inserts (replaces) item into the cache (\ArrayAccess implementation).
void
offsetUnset (string $key)
Removes the specified item from the cache.
void
release ()
Discards the internal cache.
void
save (string $key, mixed $data, [$dp = NULL])
Writes item into the cache.
Methods Inherited From Object
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()
Constant Summary
string ALL 'all'

line 44

dependency
string CALLBACKS 'callbacks'

line 43

dependency
string CONSTS 'consts'

line 42

dependency
string EXPIRE 'expire'

line 37

dependency
string FILES 'files'

line 40

dependency
string ITEMS 'items'

line 41

dependency
string PRIORITY 'priority'

line 36

dependency
string REFRESH 'sliding'

line 48

string SLIDING 'sliding'

line 38

dependency
string TAGS 'tags'

line 39

dependency

Method Details

line 292

checkCallbacks

public static bool checkCallbacks (array $callbacks)

Checks CALLBACKS dependencies.

Input
array $callbacks
Output
bool  

line 190

clean

public void clean ([$conds = NULL])

Removes items from the cache by conditions.

Conditions are:

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

Input
$conds
Output
void  

line 67

__construct

public Cache __construct (ICacheStorage $storage, [$namespace = NULL])

Input
ICacheStorage $storage
$namespace
Output
Cache  

line 94

getNamespace

public string getNamespace ()

Returns cache namespace.

Output
string  

line 83

getStorage

public ICacheStorage getStorage ()

Returns cache storage.

Output
ICacheStorage  

line 252

offsetExists

public bool offsetExists (string $key)

Exists item in cache? (\ArrayAccess implementation).

Implementation of:

ArrayAccess::offsetExists
Input
string $key key
Output
bool  
Throws
throws InvalidArgumentException

line 230

offsetGet

public mixed|NULL offsetGet (string $key)

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

Implementation of:

ArrayAccess::offsetGet
Input
string $key key
Output
mixed|NULL  
Throws
throws InvalidArgumentException

line 208

offsetSet

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

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

Implementation of:

ArrayAccess::offsetSet
Input
string $key key
mixed $data
Output
void  
Throws
throws InvalidArgumentException

line 271

offsetUnset

public void offsetUnset (string $key)

Removes the specified item from the cache.

Implementation of:

ArrayAccess::offsetUnset
Input
string $key key
Output
void  
Throws
throws InvalidArgumentException

line 105

release

public void release ()

Discards the internal cache.

Output
void  

line 129

save

public void save (string $key, mixed $data, [$dp = NULL])

Writes item into the cache.

Dependencies are:

  • Cache::PRIORITY => (int) priority
  • Cache::EXPIRE => (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

Input
string $key key
mixed $data value
$dp dependencies
Output
void  
Throws
throws InvalidArgumentException