mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
5
library/think/cache/driver/Memcache.php
vendored
5
library/think/cache/driver/Memcache.php
vendored
@@ -113,7 +113,10 @@ class Memcache extends Driver
|
|||||||
public function inc($name, $step = 1)
|
public function inc($name, $step = 1)
|
||||||
{
|
{
|
||||||
$key = $this->getCacheKey($name);
|
$key = $this->getCacheKey($name);
|
||||||
return $this->handler->increment($key, $step);
|
if( $this->has($name) ){
|
||||||
|
return $this->handler->increment($key, $step);
|
||||||
|
}
|
||||||
|
return $this->handler->set($key, $step);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
5
library/think/cache/driver/Memcached.php
vendored
5
library/think/cache/driver/Memcached.php
vendored
@@ -125,7 +125,10 @@ class Memcached extends Driver
|
|||||||
public function inc($name, $step = 1)
|
public function inc($name, $step = 1)
|
||||||
{
|
{
|
||||||
$key = $this->getCacheKey($name);
|
$key = $this->getCacheKey($name);
|
||||||
return $this->handler->increment($key, $step);
|
if( $this->has($name) ){
|
||||||
|
return $this->handler->increment($key, $step);
|
||||||
|
}
|
||||||
|
return $this->handler->set($key, $step);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -651,16 +651,16 @@ class Query
|
|||||||
if (!Cache::has($guid . '_time')) {
|
if (!Cache::has($guid . '_time')) {
|
||||||
// 计时开始
|
// 计时开始
|
||||||
Cache::set($guid . '_time', $_SERVER['REQUEST_TIME'], 0);
|
Cache::set($guid . '_time', $_SERVER['REQUEST_TIME'], 0);
|
||||||
Cache::$type($guid, $step, 0);
|
Cache::$type($guid, $step);
|
||||||
} elseif ($_SERVER['REQUEST_TIME'] > Cache::get($guid . '_time') + $lazyTime) {
|
} elseif ($_SERVER['REQUEST_TIME'] > Cache::get($guid . '_time') + $lazyTime) {
|
||||||
// 删除缓存
|
// 删除缓存
|
||||||
$value = Cache::$type($guid, $step, 0);
|
$value = Cache::$type($guid, $step);
|
||||||
Cache::rm($guid);
|
Cache::rm($guid);
|
||||||
Cache::rm($guid . '_time');
|
Cache::rm($guid . '_time');
|
||||||
return 0 === $value ? false : $value;
|
return 0 === $value ? false : $value;
|
||||||
} else {
|
} else {
|
||||||
// 更新缓存
|
// 更新缓存
|
||||||
Cache::$type($guid, $step, 0);
|
Cache::$type($guid, $step);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user