Cache class.
Protected constructor since this is a static class.
NULL
protected function __construct()
{
// Nothing here
}
Returns an instance of the requested cache configuration.
| Type | Description |
|---|---|
| string | (optional) Cache configuration name |
mako\cache\Adapter
public static function instance($name = null)
{
$config = Config::get('cache');
$name = ($name === null) ? $config['default'] : $name;
if(!isset(static::$instances[$name]))
{
if(isset($config['configurations'][$name]) === false)
{
throw new RuntimeException(vsprintf("%s(): '%s' has not been defined in the cache configuration.", array(__METHOD__, $name)));
}
$class = '\mako\cache\\' . $config['configurations'][$name]['type'];
static::$instances[$name] = new $class($config['configurations'][$name]);
}
return static::$instances[$name];
}
Magic shortcut to the default cache instance.
| Type | Description |
|---|---|
| string | Method name |
| array | Method arguments |
mixed
public static function __callStatic($name, $arguments)
{
return call_user_func_array(array(static::instance(), $name), $arguments);
}