From 94093b5bc6a261f39c5ba736450f6da4d17036ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 8 Sep 2020 17:58:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Cache/Redis.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/System/Cache/Redis.php b/System/Cache/Redis.php index df6ffa02..55c851ef 100644 --- a/System/Cache/Redis.php +++ b/System/Cache/Redis.php @@ -295,12 +295,15 @@ class Redis extends Component */ public function lock($key, $timeout = 5) { - $redis = $this->proxy(); - if (!$redis->setnx($key, 1)) { - return false; - } - $redis->expire($key, $timeout); - return true; + $script = <<