php-censor/src/B8Framework/Cache.php
2016-06-23 21:18:41 +06:00

29 lines
476 B
PHP
Executable file

<?php
namespace b8;
/**
* @package b8
* @subpackage Cache
*/
class Cache
{
const TYPE_APC = 'ApcCache';
const TYPE_REQUEST = 'RequestCache';
protected static $instance = array();
/**
* Get a cache object of a specified type.
*/
public static function getCache($type = self::TYPE_REQUEST)
{
if (!isset(self::$instance[$type])) {
$class = '\\b8\\Cache\\' . $type;
self::$instance[$type] = new $class();
}
return self::$instance[$type];
}
}