Class CacheEngine
Storage engine for CakePHP caching
Direct Subclasses
Package: Cake\Cache
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Cache/CacheEngine.php
Properties summary
-
$_groupPrefix
protectedstring
Contains the compiled string with all groups prefixes to be prepended to every key in this cache engine
-
$settings
publicSettings of current engine instancearray
Method Summary
- add() publicWrite value for a key into cache if it doesn't already exist
- Delete all keys from the cache
- clearGroup() public
Clears all values belonging to a group. Is up to the implementing engine to decide whether actually delete the keys or just simulate it to achieve the same result.
- Decrement a number under the key and return decremented value
- Delete a key from the cache
- gc() publicGarbage collection
- groups() public
Does whatever initialization for each group is required and returns the
group value
for each of them, this is the token representing each group in the cache key - Increment a number under the key and return incremented value
- init() publicInitialize the cache engine
- key() publicGenerates a safe key for use with cache engine storage engines.
- Read a key from the cache
- settings() publicCache Engine settings
- Write value for a key into cache
Method Detail
add()source public
add( string $key , mixed $value , integer $duration )
Write value for a key into cache if it doesn't already exist
Parameters
- string
$key
- Identifier for the data
- mixed
$value
- Data to be cached
- integer
$duration
- How long to cache for.
Returns
booleanTrue if the data was successfully cached, false on failure
clear()source abstract public
clear( boolean $check )
Delete all keys from the cache
Parameters
- boolean
$check
- if true will check expiration, otherwise delete all
Returns
booleanTrue if the cache was successfully cleared, false otherwise
clearGroup()source public
clearGroup( string $group )
Clears all values belonging to a group. Is up to the implementing engine to decide whether actually delete the keys or just simulate it to achieve the same result.
Parameters
- string
$group
- name of the group to be cleared
Returns
booleandecrement()source abstract public
decrement( string $key , integer $offset 1 )
Decrement a number under the key and return decremented value
Parameters
- string
$key
- Identifier for the data
- integer
$offset
optional 1 - How much to subtract
Returns
Newincremented value, false otherwise
delete()source abstract public
delete( string $key )
Delete a key from the cache
Parameters
- string
$key
- Identifier for the data
Returns
booleanTrue if the value was successfully deleted, false if it didn't exist or couldn't be removed
gc()source public
gc( integer $expires null )
Garbage collection
Permanently remove all expired and deleted data
Parameters
- integer
$expires
optional null - [optional] An expires timestamp, invalidating all data before.
groups()source public
groups( )
Does whatever initialization for each group is required and returns the group value
for each of them, this is the token representing each group in the cache key
Returns
arrayincrement()source abstract public
increment( string $key , integer $offset 1 )
Increment a number under the key and return incremented value
Parameters
- string
$key
- Identifier for the data
- integer
$offset
optional 1 - How much to add
Returns
Newincremented value, false otherwise
init()source public
init( array $settings array() )
Initialize the cache engine
Called automatically by the cache frontend
Parameters
- array
$settings
optional array() - Associative array of parameters for the engine
Returns
booleanTrue if the engine has been successfully initialized, false if not
key()source public
key( string $key )
Generates a safe key for use with cache engine storage engines.
Parameters
- string
$key
- the key passed over
Returns
mixedstring $key or false
read()source abstract public
read( string $key )
Read a key from the cache
Parameters
- string
$key
- Identifier for the data
Returns
mixedThe cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
write()source abstract public
write( string $key , mixed $value , integer $duration )
Write value for a key into cache
Parameters
- string
$key
- Identifier for the data
- mixed
$value
- Data to be cached
- integer
$duration
- How long to cache for.
Returns
booleanTrue if the data was successfully cached, false on failure
Properties detail
$_groupPrefixsource
protected string
Contains the compiled string with all groups prefixes to be prepended to every key in this cache engine
null
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/2.9/class-CacheEngine.html