缓存驱动类调整

This commit is contained in:
thinkphp
2016-01-04 17:57:42 +08:00
parent 91ac44c85d
commit c8a5a03cf4
11 changed files with 38 additions and 23 deletions

View File

@@ -11,6 +11,8 @@
namespace think\cache\driver;
use think\Cache;
/**
* 数据库方式缓存驱动
* CREATE TABLE think_cache (
@@ -55,7 +57,7 @@ class Db
*/
public function get($name)
{
\think\Cache::$readTimes++;
Cache::$readTimes++;
$name = $this->options['prefix'] . addslashes($name);
$result = $this->handler->query('SELECT `data`,`datacrc` FROM `' . $this->options['table'] . '` WHERE `cachekey`=\'' . $name . '\' AND (`expire` =0 OR `expire`>' . time() . ') LIMIT 0,1');
if (false !== $result) {
@@ -82,7 +84,7 @@ class Db
*/
public function set($name, $value, $expire = null)
{
\think\Cache::$writeTimes++;
Cache::$writeTimes++;
$data = serialize($value);
$name = $this->options['prefix'] . addslashes($name);
if (function_exists('gzcompress')) {