改进缓存类的remember方法

This commit is contained in:
thinkphp
2017-09-24 12:31:14 +08:00
parent b673555aab
commit d114f59194

View File

@@ -122,6 +122,7 @@ abstract class Driver
if (!$this->has($name)) {
while ($this->has($name . '_lock')) {
// 存在锁定则等待
usleep(100000);
}
try {
@@ -136,6 +137,8 @@ abstract class Driver
} catch (\Exception $e) {
// 解锁
$this->rm($name . '_lock');
} catch (\throwable $e) {
$this->rm($name . '_lock');
}
} else {
$value = $this->get($name);