abstract Cache
Kohana_Cache

Class Contents

Class declared in MODPATH/cache/classes/cache.php on line 3.

Constants

DEFAULT_EXPIRE
integer 3600

Properties

public static $default
string(4) "file"
public static $instances
array(0) 

Methods

public __clone( )
Kohana_Cache

Source Code
public function __clone()
{
	throw new Kohana_Cache_Exception('Cloning of Kohana_Cache objects is forbidden');
}

protected __construct( )
Kohana_Cache

Source Code
protected function __construct(array $config)
{
	$this->_config = $config;
}

protected _sanitize_id( )
Kohana_Cache

Source Code
protected function _sanitize_id($id)
{
	// Change slashes and spaces to underscores
	return str_replace(array('/', '\\', ' '), '_', $id);
}

abstract public delete( )
Kohana_Cache

Source Code
abstract public function delete($id);

abstract public delete_all( )
Kohana_Cache

Source Code
abstract public function delete_all();

abstract public get( )
Kohana_Cache

Source Code
abstract public function get($id, $default = NULL);

public static instance( )
Kohana_Cache

Source Code
public static function instance($group = NULL)
{
	// If there is no group supplied
	if ($group === NULL)
	{
		// Use the default setting
		$group = Cache::$default;
	}

	if (isset(Cache::$instances[$group]))
	{
		// Return the current group if initiated already
		return Cache::$instances[$group];
	}

	$config = Kohana::config('cache');

	if ( ! $config->offsetExists($group))
	{
		throw new Kohana_Cache_Exception('Failed to load Kohana Cache group: :group', array(':group' => $group));
	}

	$config = $config->get($group);

	// Create a new cache type instance
	$cache_class = 'Cache_'.ucfirst($config['driver']);
	Cache::$instances[$group] = new $cache_class($config);

	// Return the instance
	return Cache::$instances[$group];
}

abstract public set( )
Kohana_Cache

Source Code
abstract public function set($id, $data, $lifetime = 3600);