mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
改进缓存类的remember方法
This commit is contained in:
3
library/think/cache/Driver.php
vendored
3
library/think/cache/Driver.php
vendored
@@ -122,6 +122,7 @@ abstract class Driver
|
|||||||
if (!$this->has($name)) {
|
if (!$this->has($name)) {
|
||||||
while ($this->has($name . '_lock')) {
|
while ($this->has($name . '_lock')) {
|
||||||
// 存在锁定则等待
|
// 存在锁定则等待
|
||||||
|
usleep(100000);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -136,6 +137,8 @@ abstract class Driver
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 解锁
|
// 解锁
|
||||||
$this->rm($name . '_lock');
|
$this->rm($name . '_lock');
|
||||||
|
} catch (\throwable $e) {
|
||||||
|
$this->rm($name . '_lock');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$value = $this->get($name);
|
$value = $this->get($name);
|
||||||
|
|||||||
Reference in New Issue
Block a user