public static function forge($identifier, $config = array())
	{
		// load the default config
		$defaults = \Config::get('cache', array());

		// $config can be either an array of config settings or the name of the storage driver
		if ( ! empty($config) and ! is_array($config) and ! is_null($config))
		{
			$config = array('driver' => $config);
		}

		// Overwrite default values with given config
		$config = array_merge($defaults, (array) $config);

		if (empty($config['driver']))
		{
			throw new \FuelException('No cache driver given or no default cache driver set.');
		}

		$class = '\\Cache_Storage_'.ucfirst($config['driver']);

		// Convert the name to a string when necessary
		$identifier = call_user_func($class.'::stringify_identifier', $identifier);

		// Return instance of the requested cache object
		return new $class($identifier, $config);
	}
public static function forge($identifier, $config = array())
	{
		// load the default config
		$defaults = \Config::get('cache', array());

		// $config can be either an array of config settings or the name of the storage driver
		if ( ! empty($config) and ! is_array($config) and ! is_null($config))
		{
			$config = array('driver' => $config);
		}

		// Overwrite default values with given config
		$config = array_merge($defaults, (array) $config);

		if (empty($config['driver']))
		{
			throw new \FuelException('No cache driver given or no default cache driver set.');
		}

		$class = '\\Cache_Storage_'.ucfirst($config['driver']);

		// Convert the name to a string when necessary
		$identifier = call_user_func($class.'::stringify_identifier', $identifier);

		// Return instance of the requested cache object
		return new $class($identifier, $config);
	}
public static function forge ( $ identifier , $ config = array ( ) ) { // load the default config $ defaults = \ Config :: get ( 'cache' , array ( ) ) ; // $config can be either an array of config settings or the name of the storage driver if ( ! empty ( $ config ) and ! is_array ( $ config ) and ! is_null ( $ config ) ) { $ config = array ( 'driver' => $ config ) ; } // Overwrite default values with given config $ config = array_merge ( $ defaults , ( array ) $ config ) ; if ( empty ( $ config [ 'driver' ] ) ) { throw new \ FuelException ( 'No cache driver given or no default cache driver set.' ) ; } $ class = '\\Cache_Storage_' . ucfirst ( $ config [ 'driver' ] ) ; // Convert the name to a string when necessary $ identifier = call_user_func ( $ class . '::stringify_identifier' , $ identifier ) ; // Return instance of the requested cache object return new $ class ( $ identifier , $ config ) ; }
Creates a new cache instance.

@param   mixed                 The identifier of the cache, can be anything but empty
@param   array|string          Either an array of settings or the storage driver to be used
@return  Cache_Storage_Driver  The new cache object
Creates a new cache instance .