Interface ICache

Description

ICache interface.

This interface must be implemented by cache managers.

  • since: 3.0
  • version: $Id: interfaces.php 1693 2007-02-13 04:33:05Z xue $
  • author: Qiang Xue <qiang.xue@gmail.com>

Located in /interfaces.php (line 191)


	
			
Method Summary
boolean add (string $id, mixed $value, integer $expire, [ICacheDependency $dependency = null])
boolean delete (string $id)
void flush ()
mixed get (string $id)
boolean set (string $id, mixed $value, integer $expire, [ICacheDependency $dependency = null])
Methods
add (line 220)

Stores a value identified by a key into cache if the cache does not contain this key.

Nothing will be done if the cache already contains the key.

  • return: true if the value is successfully stored into cache, false otherwise
  • access: public
boolean add (string $id, mixed $value, integer $expire, [ICacheDependency $dependency = null])
  • string $id: the key identifying the value to be cached
  • mixed $value: the value to be cached
  • integer $expire: the number of seconds in which the cached value will expire. 0 means never expire.
  • ICacheDependency $dependency: dependency of the cached item. If the dependency changes, the item is labelled invalid.
delete (line 226)

Deletes a value with the specified key from cache

  • return: if no error happens during deletion
  • access: public
boolean delete (string $id)
  • string $id: the key of the value to be deleted
flush (line 231)

Deletes all values from cache.

Be careful of performing this operation if the cache is shared by multiple applications.

  • access: public
void flush ()
get (line 198)

Retrieves a value from cache with a specified key.

  • return: the value stored in cache, false if the value is not in the cache or expired.
  • access: public
mixed get (string $id)
  • string $id: a key identifying the cached value
set (line 210)

Stores a value identified by a key into cache.

If the cache already contains such a key, the existing value and expiration time will be replaced with the new ones.

  • return: true if the value is successfully stored into cache, false otherwise
  • access: public
boolean set (string $id, mixed $value, integer $expire, [ICacheDependency $dependency = null])
  • string $id: the key identifying the value to be cached
  • mixed $value: the value to be cached
  • integer $expire: the number of seconds in which the cached value will expire. 0 means never expire.
  • ICacheDependency $dependency: dependency of the cached item. If the dependency changes, the item is labelled invalid.

Documentation generated on Mon, 21 Apr 2008 11:29:23 -0400 by phpDocumentor 1.3.0RC4