FUEL CMS User Guide : Version 1.5.2


Cache Class

A generic file based caching class originally found on the CI Forums. This class is the basis for the more FUEL specific Fuel_cache class.

Properties Reference

Property Default Value Description
public
cache_postfix .cache
expiry_postfix .exp
group_postfix .group
default_ttl 3600
cache_path /var/www/vhosts/getfuelcms.com/subdomains/docs/httpdocs/fuel/application/cache/

Function Reference [+]

$this->cache->initialize([$params=array()])

Initialize the object and set object parameters. Accepts an associative array as input, containing object preferences. Also will set the values in the parameters array as properties of this object.

Returns

void

Parameters

(array) $params Config preferences

$this->cache->set_cache_path('$path')

Sets the cache path.

Returns

void

Parameters

(string) $path The path to the cache folder

$this->cache->set_params($params)

Set object parameters.

Returns

void

Parameters

(array) $params Config preferences

$this->cache->is_cached('$cache_id', ['$cache_group'=NULL])

Check if a item has a (valid) cache. @param Cache ID @param Cache group ID (optional) @return Boolean indicating if cache available.

Returns

Boolean indicating if cache available

Parameters

(Cache) $cache_id ID
(Cache) $cache_group group ID (optional)

$this->cache->save('$cache_id', '$data', ['$cache_group'=NULL], ['$ttl'=NULL])

Save an item to the cache. @param Cache ID @param Data object @param Cache group ID (optional) @param Time to live for this item (optional) @return void.

Returns

void

Parameters

(Cache) $cache_id ID
(Data) $data object
(Cache) $cache_group group ID (optional)
(Time) $ttl to live for this item (optional)

$this->cache->get('$cache_id', ['$cache_group'=NULL], ['$skip_checking'=FALSE])

Get and return an item from the cache. @param Cache ID @param Cache group ID (optional) @param Should I check the expiry time? (optional) @return The object or NULL if not available.

Returns

The object or NULL if not available

Parameters

(Cache) $cache_id ID
(Cache) $cache_group group ID (optional)
(Should) $skip_checking I check the expiry time? (optional)

$this->cache->remove('$cache_id', ['$cache_group'=NULL])

Remove an item from the cache. @param Cache ID @param Cache group ID (optional) @return void.

Returns

void

Parameters

(Cache) $cache_id ID
(Cache) $cache_group group ID (optional)

$this->cache->remove_group('$cache_group')

Remove an entire group. @param Cache group ID.

Parameters

(Cache) $cache_group group ID

$this->cache->remove_ids('$cache_ids', ['$cache_group'=NULL])

Remove an array of cached items. @param Array of cache IDs @param Cache group ID.

Parameters

(Array) $cache_ids of cache IDs
(Cache) $cache_group group ID