@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | // +---------------------------------------------------------------------- |
| 9 | 9 | // | Author: liu21st <[email protected]> |
| 10 | 10 | // +---------------------------------------------------------------------- |
| 11 | -declare (strict_types = 1); |
|
| 11 | +declare(strict_types=1); |
|
| 12 | 12 | |
| 13 | 13 | namespace think\cache; |
| 14 | 14 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function getCacheKey(string $name): string |
| 86 | 86 | { |
| 87 | - return $this->options['prefix'] . $name; |
|
| 87 | + return $this->options['prefix'].$name; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -145,14 +145,14 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $time = time(); |
| 147 | 147 | |
| 148 | - while ($time + 5 > time() && $this->has($name . '_lock')) { |
|
| 148 | + while ($time + 5 > time() && $this->has($name.'_lock')) { |
|
| 149 | 149 | // 存在锁定则等待 |
| 150 | 150 | usleep(200000); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | try { |
| 154 | 154 | // 锁定 |
| 155 | - $this->set($name . '_lock', true); |
|
| 155 | + $this->set($name.'_lock', true); |
|
| 156 | 156 | |
| 157 | 157 | if ($value instanceof Closure) { |
| 158 | 158 | // 获取缓存数据 |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | $this->set($name, $value, $expire); |
| 164 | 164 | |
| 165 | 165 | // 解锁 |
| 166 | - $this->delete($name . '_lock'); |
|
| 166 | + $this->delete($name.'_lock'); |
|
| 167 | 167 | } catch (Exception | throwable $e) { |
| 168 | - $this->delete($name . '_lock'); |
|
| 168 | + $this->delete($name.'_lock'); |
|
| 169 | 169 | throw $e; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $key = implode('-', $name); |
| 185 | 185 | |
| 186 | 186 | if (!isset($this->tag[$key])) { |
| 187 | - $name = array_map(function ($val) { |
|
| 187 | + $name = array_map(function($val) { |
|
| 188 | 188 | return $this->getTagKey($val); |
| 189 | 189 | }, $name); |
| 190 | 190 | $this->tag[$key] = new TagSet($name, $this); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | public function getTagKey(string $tag): string |
| 214 | 214 | { |
| 215 | - return $this->options['tag_prefix'] . md5($tag); |
|
| 215 | + return $this->options['tag_prefix'].md5($tag); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |