diff --git a/library/think/cache/Driver.php b/library/think/cache/Driver.php index 021ae727..f77ac30b 100644 --- a/library/think/cache/Driver.php +++ b/library/think/cache/Driver.php @@ -91,6 +91,23 @@ abstract class Driver 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