You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
829 B

<?php
/**
* @copyright NetMonsters <team@netmonsters.ru>
* @link http://netmonsters.ru
* @package Majestic
* @subpackage Cache
* @since 2010-03-04
* @version SVN: $Id$
* @filesource $URL$
*/
class Cacher
{
/**
* Initialized cachers
*
* @var array
*/
static protected $caches = array();
static public function get($cacher, $config = null)
{
if (!isset(self::$caches[$cacher])) {
if (!$config) {
$config = Config::get($cacher);
}
$cache = new $cacher($config);
if (!$cache instanceof Cache) {
throw new InitializationException('Cache driver "' . $cacher . '" must extends Cache');
}
self::$caches[$cacher] = $cache;
}
return self::$caches[$cacher];
}
}