Files
framework/library/think/cache.php
huangdijia 4ef5a0bcba 使用新的自动加载机制
preg_replace_callback取代/e模式
2015-03-03 18:33:47 +08:00

39 lines
1.3 KiB
PHP

<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2015 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think;
class Cache {
/**
* 操作句柄
* @var object
* @access protected
*/
static protected $handler = null;
/**
* 连接缓存
* @access public
* @param array $options 配置数组
* @return object
*/
static public function connect($options=[]) {
$type = !empty($options['type'])?$options['type']:'File';
$class = 'think\\cache\\driver\\'.strtolower($type);
self::$handler = new $class($options);
return self::$handler;
}
static public function __callStatic($method, $params){
return call_user_func_array(array(self::$handler, $method), $params);
}
}