@@ -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 | /** |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $data = gzcompress($data, 3); |
182 | 182 | } |
183 | 183 | |
184 | - $data = "<?php\n//" . sprintf('%012d', $expire) . "\n exit();?>\n" . $data; |
|
184 | + $data = "<?php\n//".sprintf('%012d', $expire)."\n exit();?>\n".$data; |
|
185 | 185 | $result = file_put_contents($filename, $data); |
186 | 186 | |
187 | 187 | if ($result) { |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | { |
251 | 251 | $this->writeTimes++; |
252 | 252 | |
253 | - $dirname = $this->options['path'] . $this->options['prefix']; |
|
253 | + $dirname = $this->options['path'].$this->options['prefix']; |
|
254 | 254 | |
255 | 255 | $this->rmdir($dirname); |
256 | 256 |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | foreach ($hosts as $i => $host) { |
64 | 64 | $port = $ports[$i] ?? $ports[0]; |
65 | 65 | $this->options['timeout'] > 0 ? |
66 | - $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1, $this->options['timeout']) : |
|
67 | - $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1); |
|
66 | + $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1, $this->options['timeout']) : $this->handler->addServer($host, (int) $port, $this->options['persistent'], 1); |
|
68 | 67 | } |
69 | 68 | } |
70 | 69 | |
@@ -176,8 +175,7 @@ discard block |
||
176 | 175 | $key = $this->getCacheKey($name); |
177 | 176 | |
178 | 177 | return false === $ttl ? |
179 | - $this->handler->delete($key) : |
|
180 | - $this->handler->delete($key, $ttl); |
|
178 | + $this->handler->delete($key) : $this->handler->delete($key, $ttl); |
|
181 | 179 | } |
182 | 180 | |
183 | 181 | /** |
@@ -118,10 +118,10 @@ |
||
118 | 118 | $redis->shouldReceive("del")->once()->with('baz')->andReturnTrue(); |
119 | 119 | $redis->shouldReceive("flushDB")->once()->andReturnTrue(); |
120 | 120 | $redis->shouldReceive("set")->once()->with('bar', \Opis\Closure\serialize('foobar'))->andReturnTrue(); |
121 | - $redis->shouldReceive("sAdd")->once()->with('tag:' . md5('foo'), 'bar')->andReturnTrue(); |
|
122 | - $redis->shouldReceive("sMembers")->once()->with('tag:' . md5('foo'))->andReturn(['bar']); |
|
121 | + $redis->shouldReceive("sAdd")->once()->with('tag:'.md5('foo'), 'bar')->andReturnTrue(); |
|
122 | + $redis->shouldReceive("sMembers")->once()->with('tag:'.md5('foo'))->andReturn(['bar']); |
|
123 | 123 | $redis->shouldReceive("del")->once()->with(['bar'])->andReturnTrue(); |
124 | - $redis->shouldReceive("del")->once()->with('tag:' . md5('foo'))->andReturnTrue(); |
|
124 | + $redis->shouldReceive("del")->once()->with('tag:'.md5('foo'))->andReturnTrue(); |
|
125 | 125 | |
126 | 126 | $this->cache->set('foo', 5); |
127 | 127 | $this->cache->inc('foo'); |