Class FileEngine
File Storage engine for cache
- CacheEngine
- FileEngine
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: cache/file.php
Properties summary
Method Summary
-
__active() public
Determine is cache directory is writable -
_setKey() public
Get absolute file for a given key -
clear() public
Delete all values from the cache -
delete() public
Delete a key from the cache -
gc() public
Garbage collection. Permanently remove all expired and deleted data -
init() public
Initialize the Cache Engine -
read() public
Read a key from the cache -
write() public
Write data for key into cache
Method Detail
_setKey() public ¶
_setKey( string $key )
Get absolute file for a given key
Parameters
- string $key
- The key
Returns
Absolute cache file for the given key or false if erroneous
clear() public ¶
clear( boolean $check )
Delete all values from the cache
Parameters
- boolean $check
- Optional - only delete expired cache items
Returns
True if the cache was succesfully cleared, false otherwise
Overrides
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
Overrides
gc() public ¶
gc( )
Garbage collection. Permanently remove all expired and deleted data
Returns
True if garbage collection was succesful, false on failure
Overrides
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()
- $setting array of setting for the engine
Returns
True if the engine has been successfully initialized, false if not
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
Overrides
write() public ¶
write( string $key , mixed $data , mixed $duration )
Write data for key into cache
Parameters
- string $key
- Identifier for the data
- mixed $data
- Data to be cached
- mixed $duration
- How long to cache the data, in seconds
Returns
True if the data was succesfully cached, false on failure
Overrides
Methods inherited from CacheEngine
decrement() 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
- $value How much to substract
Returns
incremented value, false otherwise
increment() 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
incremented value, false otherwise