@@ -8,7 +8,7 @@ |
||
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\contract; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
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 |
@@ -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 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function getCacheKey(string $name): string |
87 | 87 | { |
88 | - return $this->options['prefix'] . $name; |
|
88 | + return $this->options['prefix'].$name; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | |
147 | 147 | $time = time(); |
148 | 148 | |
149 | - while ($time + 5 > time() && $this->has($name . '_lock')) { |
|
149 | + while ($time + 5 > time() && $this->has($name.'_lock')) { |
|
150 | 150 | // 存在锁定则等待 |
151 | 151 | usleep(200000); |
152 | 152 | } |
153 | 153 | |
154 | 154 | try { |
155 | 155 | // 锁定 |
156 | - $this->set($name . '_lock', true); |
|
156 | + $this->set($name.'_lock', true); |
|
157 | 157 | |
158 | 158 | if ($value instanceof Closure) { |
159 | 159 | // 获取缓存数据 |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | $this->set($name, $value, $expire); |
165 | 165 | |
166 | 166 | // 解锁 |
167 | - $this->delete($name . '_lock'); |
|
167 | + $this->delete($name.'_lock'); |
|
168 | 168 | } catch (Exception | throwable $e) { |
169 | - $this->delete($name . '_lock'); |
|
169 | + $this->delete($name.'_lock'); |
|
170 | 170 | throw $e; |
171 | 171 | } |
172 | 172 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $key = implode('-', $name); |
186 | 186 | |
187 | 187 | if (!isset($this->tag[$key])) { |
188 | - $name = array_map(function ($val) { |
|
188 | + $name = array_map(function($val) { |
|
189 | 189 | return $this->getTagKey($val); |
190 | 190 | }, $name); |
191 | 191 | $this->tag[$key] = new TagSet($name, $this); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function getTagKey(string $tag): string |
215 | 215 | { |
216 | - return $this->options['tag_prefix'] . md5($tag); |
|
216 | + return $this->options['tag_prefix'].md5($tag); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -8,7 +8,7 @@ |
||
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\driver; |
14 | 14 |
@@ -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\driver; |
14 | 14 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->handler = new \Redis; |
59 | 59 | |
60 | 60 | if ($this->options['persistent']) { |
61 | - $this->handler->pconnect($this->options['host'], (int) $this->options['port'], (int) $this->options['timeout'], 'persistent_id_' . $this->options['select']); |
|
61 | + $this->handler->pconnect($this->options['host'], (int) $this->options['port'], (int) $this->options['timeout'], 'persistent_id_'.$this->options['select']); |
|
62 | 62 | } else { |
63 | 63 | $this->handler->connect($this->options['host'], (int) $this->options['port'], (int) $this->options['timeout']); |
64 | 64 | } |
@@ -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\driver; |
14 | 14 | |
@@ -191,8 +191,7 @@ discard block |
||
191 | 191 | $key = $this->getCacheKey($name); |
192 | 192 | |
193 | 193 | return false === $ttl ? |
194 | - $this->handler->delete($key) : |
|
195 | - $this->handler->delete($key, $ttl); |
|
194 | + $this->handler->delete($key) : $this->handler->delete($key, $ttl); |
|
196 | 195 | } |
197 | 196 | |
198 | 197 | /** |
@@ -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\driver; |
14 | 14 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | if (empty($this->options['path'])) { |
51 | - $this->options['path'] = $app->getRuntimePath() . 'cache'; |
|
51 | + $this->options['path'] = $app->getRuntimePath().'cache'; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | if (substr($this->options['path'], -1) != DIRECTORY_SEPARATOR) { |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | |
69 | 69 | if ($this->options['cache_subdir']) { |
70 | 70 | // 使用子目录 |
71 | - $name = substr($name, 0, 2) . DIRECTORY_SEPARATOR . substr($name, 2); |
|
71 | + $name = substr($name, 0, 2).DIRECTORY_SEPARATOR.substr($name, 2); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | if ($this->options['prefix']) { |
75 | - $name = $this->options['prefix'] . DIRECTORY_SEPARATOR . $name; |
|
75 | + $name = $this->options['prefix'].DIRECTORY_SEPARATOR.$name; |
|
76 | 76 | } |
77 | 77 | |
78 | - return $this->options['path'] . $name . '.php'; |
|
78 | + return $this->options['path'].$name.'.php'; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $data = gzcompress($data, 3); |
176 | 176 | } |
177 | 177 | |
178 | - $data = "<?php\n//" . sprintf('%012d', $expire) . "\n exit();?>\n" . $data; |
|
178 | + $data = "<?php\n//".sprintf('%012d', $expire)."\n exit();?>\n".$data; |
|
179 | 179 | $result = file_put_contents($filename, $data); |
180 | 180 | |
181 | 181 | if ($result) { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | $this->writeTimes++; |
242 | 242 | |
243 | - $dirname = $this->options['path'] . $this->options['prefix']; |
|
243 | + $dirname = $this->options['path'].$this->options['prefix']; |
|
244 | 244 | |
245 | 245 | $this->rmdir($dirname); |
246 | 246 |
@@ -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\driver; |
14 | 14 | |
@@ -64,8 +64,7 @@ discard block |
||
64 | 64 | foreach ($hosts as $i => $host) { |
65 | 65 | $port = $ports[$i] ?? $ports[0]; |
66 | 66 | $this->options['timeout'] > 0 ? |
67 | - $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1, (int) $this->options['timeout']) : |
|
68 | - $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1); |
|
67 | + $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1, (int) $this->options['timeout']) : $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1); |
|
69 | 68 | } |
70 | 69 | } |
71 | 70 | |
@@ -177,8 +176,7 @@ discard block |
||
177 | 176 | $key = $this->getCacheKey($name); |
178 | 177 | |
179 | 178 | return false === $ttl ? |
180 | - $this->handler->delete($key) : |
|
181 | - $this->handler->delete($key, $ttl); |
|
179 | + $this->handler->delete($key) : $this->handler->delete($key, $ttl); |
|
182 | 180 | } |
183 | 181 | |
184 | 182 | /** |
@@ -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; |
14 | 14 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function getConfig(string $name = null, $default = null) |
42 | 42 | { |
43 | 43 | if (!is_null($name)) { |
44 | - return $this->app->config->get('session.' . $name, $default); |
|
44 | + return $this->app->config->get('session.'.$name, $default); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | return $this->app->config->get('session'); |