Class ApcEngine
APC storage engine for cache
- CacheEngine
- ApcEngine
Copyright: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
License: MIT License
Location: Cake/Cache/Engine/ApcEngine.php
Properties summary
-
$_apcExtension
protectedstring
APC or APCu extension -
$_compiledGroupNames
protectedarray
Contains the compiled group names (prefixed with the global configuration prefix)
Inherited Properties
Method Summary
-
add() public
Write data for key into cache if it doesn't exist already. If it already exists, it fails and returns false.
-
clear() public
Delete all keys from the cache. This will clear every cache config using APC. -
clearGroup() public
Increments the group value to simulate deletion of all keys under a group old values will remain in storage until they expire.
-
decrement() public
Decrements the value of an integer cached key -
delete() public
Delete a key from the cache -
groups() public
Returns the
group value
for each of the configured groups If the group initial value was not found, then it initializes the group accordingly. -
increment() public
Increments the value of an integer cached key -
init() public
Initialize the Cache Engine -
read() public
Read a key from the cache -
write() public
Write data for key into cache
Method Detail
add() public ¶
add( string $key , mixed $value , integer $duration )
Write data for key into cache if it doesn't exist already. If it already exists, it fails and returns false.
Parameters
- string $key
- Identifier for the data.
- mixed $value
- Data to be cached.
- integer $duration
- How long to cache the data, in seconds.
Returns
True if the data was successfully cached, false on failure.
Link
Overrides
clear() public ¶
clear( boolean $check )
Delete all keys from the cache. This will clear every cache config using APC.
Parameters
- boolean $check
If true, nothing will be cleared, as entries are removed from APC as they expired. This flag is really only used by FileEngine.
Returns
True Returns true.
clearGroup() public ¶
clearGroup( string $group )
Increments the group value to simulate deletion of all keys under a group old values will remain in storage until they expire.
Parameters
- string $group
- The group to clear.
Returns
success
Overrides
decrement() public ¶
decrement( string $key , integer $offset = 1 )
Decrements the value of an integer cached key
Parameters
- string $key
- Identifier for the data
- integer $offset optional 1
- How much to subtract
Returns
decremented value, false otherwise
delete() public ¶
delete( string $key )
Delete a key from the cache
Parameters
- string $key
- Identifier for the data
Returns
True if the value was successfully deleted, false if it didn't exist or couldn't be removed
groups() public ¶
groups( )
Returns the group value
for each of the configured groups
If the group initial value was not found, then it initializes
the group accordingly.
Returns
Overrides
increment() public ¶
increment( string $key , integer $offset = 1 )
Increments the value of an integer cached key
Parameters
- string $key
- Identifier for the data
- integer $offset optional 1
- How much to increment
Returns
incremented value, false otherwise
init() public ¶
init( array $settings = array() )
Initialize the Cache Engine
Called automatically by the cache frontend To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
Parameters
- array $settings optional array()
- array of setting for the engine
Returns
True if the engine has been successfully initialized, false if not
See
Overrides
read() public ¶
read( string $key )
Read a key from the cache
Parameters
- string $key
- Identifier for the data
Returns
The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
write() public ¶
write( string $key , mixed $value , integer $duration )
Write data for key into cache
Parameters
- string $key
- Identifier for the data
- mixed $value
- Data to be cached
- integer $duration
- How long to cache the data, in seconds
Returns
True if the data was successfully cached, false on failure
Methods inherited from CacheEngine
gc() 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.
Properties detail
$_compiledGroupNames ¶
Contains the compiled group names (prefixed with the global configuration prefix)
array()