\APICache

Caching for CakePHP.

Summary

Methods
Properties
Constants
__construct()
getInstance()
config()
engine()
gc()
write()
read()
delete()
clear()
settings()
key()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct() : 

APICache::__construct()

Returns

getInstance()

getInstance() : 

Returns a singleton instance

Returns

config()

config(string|array  name = default, mixed||string|int  settings = array()) : mixed||string|int

Set the cache configuration to use

Parameters

string|array name

Name of the configuration

mixed||string|int settings

Optional associative array of settings passed to the engine

Returns

mixed||string|int —

(engine, settings) on success, false on failure

engine()

engine(  name = file, mixed||string|int  settings = array()) : 

Set the cache engine to use or modify settings for one instance

Parameters

name

Name of the engine (without 'Engine')

mixed||string|int settings

Optional associative array of settings passed to the engine

Returns

True on success, false on failure

gc()

gc() : 

Garbage collection

Permanently remove all expired and deleted data

Returns

write()

write(  key,   value,   duration = null) : 

Write data for key into cache

Parameters

key

Identifier for the data

value

Data to be cached - anything except a resource

duration

Optional - string configuration name OR how long to cache the data, either in seconds or a string that can be parsed by the strtotime() function OR array('config' => 'default', 'duration' => '3600')

Returns

True if the data was successfully cached, false on failure

read()

read(  key, string|array  config = null) : 

Read a key from the cache

Parameters

key

Identifier for the data

string|array config

name of the configuration to use

Returns

The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it

delete()

delete(  key,   config = null) : 

Delete a key from the cache

Parameters

key

Identifier for the data

config

name of the configuration to use

Returns

True if the value was successfully deleted, false if it didn't exist or couldn't be removed

clear()

clear(  check = false,   config = null) : 

Delete all keys from the cache

Parameters

check

if true will check expiration, otherwise delete all

config

name of the configuration to use

Returns

True if the cache was successfully cleared, false otherwise

settings()

settings(  engine = null) : mixed||string|int

Return the settings for current cache engine

Parameters

engine

Name of the engine

Returns

mixed||string|int —

list of settings for this engine

key()

key(  key) : 

generates a safe key

Parameters

key

the key passed over

Returns

string $key or false