mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进file类型的缓存inc和dec方法不改变缓存有效期
This commit is contained in:
10
library/think/cache/driver/File.php
vendored
10
library/think/cache/driver/File.php
vendored
@@ -171,10 +171,13 @@ class File extends Driver
|
|||||||
{
|
{
|
||||||
if ($this->has($name)) {
|
if ($this->has($name)) {
|
||||||
$value = $this->get($name) + $step;
|
$value = $this->get($name) + $step;
|
||||||
|
$expire = $this->expire;
|
||||||
} else {
|
} else {
|
||||||
$value = $step;
|
$value = $step;
|
||||||
|
$expire = 0;
|
||||||
}
|
}
|
||||||
return $this->set($name, $value, 0) ? $value : false;
|
|
||||||
|
return $this->set($name, $value, $expire) ? $value : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -188,10 +191,13 @@ class File extends Driver
|
|||||||
{
|
{
|
||||||
if ($this->has($name)) {
|
if ($this->has($name)) {
|
||||||
$value = $this->get($name) - $step;
|
$value = $this->get($name) - $step;
|
||||||
|
$expire = $this->expire;
|
||||||
} else {
|
} else {
|
||||||
$value = -$step;
|
$value = -$step;
|
||||||
|
$expire = 0;
|
||||||
}
|
}
|
||||||
return $this->set($name, $value, 0) ? $value : false;
|
|
||||||
|
return $this->set($name, $value, $expire) ? $value : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user