mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
缓存驱动类调整
This commit is contained in:
6
library/think/cache/driver/Db.php
vendored
6
library/think/cache/driver/Db.php
vendored
@@ -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')) {
|
||||
|
||||
Reference in New Issue
Block a user