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.
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.
Deletes a value with the specified key from cache
boolean
delete
(string $id)
-
string
$id: the key of the value to be deleted
Deletes all values from cache.
Be careful of performing this operation if the cache is shared by multiple applications.
void
flush
()
Retrieves a value from cache with a specified key.
mixed
get
(string $id)
-
string
$id: a key identifying the cached value
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.
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.