mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
Cache类增加pull方法用于获取缓存数据并删除
This commit is contained in:
17
library/think/cache/Driver.php
vendored
17
library/think/cache/Driver.php
vendored
@@ -91,6 +91,23 @@ abstract class Driver
|
|||||||
return $this->options['prefix'] . $name;
|
return $this->options['prefix'] . $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取缓存并删除
|
||||||
|
* @access public
|
||||||
|
* @param string $name 缓存变量名
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function pull($name)
|
||||||
|
{
|
||||||
|
$result = $this->get($name, false);
|
||||||
|
if ($result) {
|
||||||
|
$this->rm($name);
|
||||||
|
return $result;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存标签
|
* 缓存标签
|
||||||
* @access public
|
* @access public
|
||||||
|
|||||||
Reference in New Issue
Block a user