缓存驱动类更新

This commit is contained in:
thinkphp
2013-04-02 15:57:27 +08:00
parent 3de1949696
commit 083b312c96
8 changed files with 11 additions and 11 deletions

View File

@@ -30,7 +30,7 @@ class Apc {
*/ */
public function __construct($options=[]) { public function __construct($options=[]) {
if(!function_exists('apc_cache_info')) { if(!function_exists('apc_cache_info')) {
throw New Exception('_NOT_SUPPERT_:Apc'); E('_NOT_SUPPERT_:Apc');
} }
if(!empty($options)) { if(!empty($options)) {
$this->options = array_merge($this->options,$options); $this->options = array_merge($this->options,$options);

View File

@@ -40,7 +40,7 @@ class Db {
if(!empty($options)) { if(!empty($options)) {
$this->options = array_merge($this->options,$options); $this->options = array_merge($this->options,$options);
} }
$this->handler = ThinkDB::getInstance(); $this->handler = \Think\Db::instance();
} }
/** /**

View File

@@ -31,13 +31,13 @@ class Memcache {
*/ */
public function __construct($options=[]) { public function __construct($options=[]) {
if ( !extension_loaded('memcache') ) { if ( !extension_loaded('memcache') ) {
throw new Exception('_NOT_SUPPERT_:memcache'); E('_NOT_SUPPERT_:memcache');
} }
if(!empty($options)) { if(!empty($options)) {
$this->options = array_merge($this->options,$options); $this->options = array_merge($this->options,$options);
} }
$func = $this->options['persistent'] ? 'pconnect' : 'connect'; $func = $this->options['persistent'] ? 'pconnect' : 'connect';
$this->handler = new Memcache; $this->handler = new \Memcache;
$options['timeout'] === false ? $options['timeout'] === false ?
$this->handler->$func($options['host'], $options['port']) : $this->handler->$func($options['host'], $options['port']) :
$this->handler->$func($options['host'], $options['port'], $options['timeout']); $this->handler->$func($options['host'], $options['port'], $options['timeout']);

View File

@@ -32,13 +32,13 @@ class Redis {
*/ */
public function __construct($options=[]) { public function __construct($options=[]) {
if ( !extension_loaded('redis') ) { if ( !extension_loaded('redis') ) {
throw new Exception('_NOT_SUPPERT_:redis'); E('_NOT_SUPPERT_:redis');
} }
if(!empty($options)) { if(!empty($options)) {
$this->options = array_merge($this->options,$options); $this->options = array_merge($this->options,$options);
} }
$func = $options['persistent'] ? 'pconnect' : 'connect'; $func = $options['persistent'] ? 'pconnect' : 'connect';
$this->handler = new Redis; $this->handler = new \Redis;
$options['timeout'] === false ? $options['timeout'] === false ?
$this->handler->$func($options['host'], $options['port']) : $this->handler->$func($options['host'], $options['port']) :
$this->handler->$func($options['host'], $options['port'], $options['timeout']); $this->handler->$func($options['host'], $options['port'], $options['timeout']);

View File

@@ -34,7 +34,7 @@ class Secache {
$this->options = array_merge($this->options,$options); $this->options = array_merge($this->options,$options);
} }
if(substr($this->options['temp'], -1) != '/') $this->options['temp'] .= '/'; if(substr($this->options['temp'], -1) != '/') $this->options['temp'] .= '/';
$this->handler = new secache; $this->handler = new SecacheClient;
$this->handler->workat($this->options['temp'].$this->options['project']); $this->handler->workat($this->options['temp'].$this->options['project']);
} }
@@ -108,7 +108,7 @@ class Secache {
if(!defined('SECACHE_SIZE')){ if(!defined('SECACHE_SIZE')){
define('SECACHE_SIZE','15M'); define('SECACHE_SIZE','15M');
} }
class secache{ class SecacheClient{
var $idx_node_size = 40; var $idx_node_size = 40;
var $data_base_pos = 262588; //40+20+24*16+16*16*16*16*4; var $data_base_pos = 262588; //40+20+24*16+16*16*16*16*4;

View File

@@ -31,7 +31,7 @@ class Sqlite {
*/ */
public function __construct($options=[]) { public function __construct($options=[]) {
if ( !extension_loaded('sqlite') ) { if ( !extension_loaded('sqlite') ) {
throw new Exception('_NOT_SUPPERT_:sqlite'); E('_NOT_SUPPERT_:sqlite');
} }
if(!empty($options)) { if(!empty($options)) {
$this->options = array_merge($this->options,$options); $this->options = array_merge($this->options,$options);

View File

@@ -28,7 +28,7 @@ class Wincache {
*/ */
public function __construct($options=[]) { public function __construct($options=[]) {
if ( !function_exists('wincache_ucache_info') ) { if ( !function_exists('wincache_ucache_info') ) {
throw new Exception('_NOT_SUPPERT_:WinCache'); E('_NOT_SUPPERT_:WinCache');
} }
if(!empty($options)) { if(!empty($options)) {
$this->options = array_merge($this->options,$options); $this->options = array_merge($this->options,$options);

View File

@@ -28,7 +28,7 @@ class Xcache {
*/ */
public function __construct($options=[]) { public function __construct($options=[]) {
if ( !function_exists('xcache_info') ) { if ( !function_exists('xcache_info') ) {
throw new Exception('_NOT_SUPPERT_:Xcache'); E('_NOT_SUPPERT_:Xcache');
} }
if(!empty($options)) { if(!empty($options)) {
$this->options = array_merge($this->options,$options); $this->options = array_merge($this->options,$options);