@@ -80,7 +80,7 @@ |
||
| 80 | 80 | * @return bool |
| 81 | 81 | * @throws \Psr\SimpleCache\InvalidArgumentException |
| 82 | 82 | * MUST be thrown if the $key string is not a legal value. |
| 83 | - */ |
|
| 83 | + */ |
|
| 84 | 84 | public function has($key) |
| 85 | 85 | { |
| 86 | 86 | return false; |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | */ |
| 74 | 74 | public function get($key, $default = null) |
| 75 | 75 | { |
| 76 | - if ($default === false) { |
|
| 76 | + if ($default === false) { |
|
| 77 | 77 | $this->logger->info("[Shmop Cache] Ignored $key because TTL=FALSE"); |
| 78 | 78 | return $default; |
| 79 | 79 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | protected function getFilenameToken($key) |
| 48 | 48 | { |
| 49 | - return sys_get_temp_dir() . '/shmop-' . sha1($key) . '.cache'; |
|
| 49 | + return sys_get_temp_dir().'/shmop-'.sha1($key).'.cache'; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | protected function getMaxSize() |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $size = strlen($serialized); |
| 139 | 139 | |
| 140 | 140 | if ($size > $this->getMaxSize()) { |
| 141 | - throw new StorageErrorException('Object is greater than the max size allowed: ' . $this->getMaxSize()); |
|
| 141 | + throw new StorageErrorException('Object is greater than the max size allowed: '.$this->getMaxSize()); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $file = $this->getFilenameToken($key); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | public function clear() |
| 211 | 211 | { |
| 212 | - $patternKey = sys_get_temp_dir() . '/shmop-*.cache'; |
|
| 212 | + $patternKey = sys_get_temp_dir().'/shmop-*.cache'; |
|
| 213 | 213 | $list = glob($patternKey); |
| 214 | 214 | foreach ($list as $file) { |
| 215 | 215 | $this->deleteFromFilenameToken($file); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | { |
| 34 | 34 | // Check if file is Locked |
| 35 | 35 | $fileKey = $this->fixKey($key); |
| 36 | - $lockFile = $fileKey . ".lock"; |
|
| 36 | + $lockFile = $fileKey.".lock"; |
|
| 37 | 37 | if (file_exists($lockFile)) { |
| 38 | 38 | $this->logger->info("[Filesystem cache] Locked! $key. Waiting..."); |
| 39 | 39 | $lockTime = filemtime($lockFile); |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $validUntil = $this->addToNow($ttl); |
| 104 | 104 | if (!empty($validUntil)) { |
| 105 | - file_put_contents($fileKey . ".ttl", $validUntil); |
|
| 105 | + file_put_contents($fileKey.".ttl", $validUntil); |
|
| 106 | 106 | } |
| 107 | 107 | } catch (Exception $ex) { |
| 108 | - $this->logger->warning("[Filesystem cache] I could not write to cache on file '" . basename($key) . "'. Switching to nocache=true mode."); |
|
| 108 | + $this->logger->warning("[Filesystem cache] I could not write to cache on file '".basename($key)."'. Switching to nocache=true mode."); |
|
| 109 | 109 | return false; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | $this->logger->info("[Filesystem cache] Lock '$key'"); |
| 133 | 133 | |
| 134 | - $lockFile = $this->fixKey($key) . ".lock"; |
|
| 134 | + $lockFile = $this->fixKey($key).".lock"; |
|
| 135 | 135 | |
| 136 | 136 | try { |
| 137 | 137 | file_put_contents($lockFile, date('c')); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $this->logger->info("[Filesystem cache] Unlock '$key'"); |
| 151 | 151 | |
| 152 | - $lockFile = $this->fixKey($key) . ".lock"; |
|
| 152 | + $lockFile = $this->fixKey($key).".lock"; |
|
| 153 | 153 | |
| 154 | 154 | if (file_exists($lockFile)) { |
| 155 | 155 | unlink($lockFile); |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | protected function fixKey($key) |
| 165 | 165 | { |
| 166 | - return sys_get_temp_dir() . '/' |
|
| 166 | + return sys_get_temp_dir().'/' |
|
| 167 | 167 | . $this->prefix |
| 168 | - . '-' . preg_replace("/[\/\\\]/", "#", $key) |
|
| 168 | + . '-'.preg_replace("/[\/\\\]/", "#", $key) |
|
| 169 | 169 | . '.cache'; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | protected function keyName($key) |
| 29 | 29 | { |
| 30 | - return $this->prefix . '-' . $key; |
|
| 30 | + return $this->prefix.'-'.$key; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function get($key, $default = null) |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | { |
| 93 | 93 | $this->expiration = new DateTime('now +1 year'); |
| 94 | 94 | if (is_numeric($time)) { |
| 95 | - $this->expiration = new DateTime('now +' . $time . ' seconds'); |
|
| 95 | + $this->expiration = new DateTime('now +'.$time.' seconds'); |
|
| 96 | 96 | } else if ($time instanceof DateInterval) { |
| 97 | 97 | $expiration = new DateTime(); |
| 98 | 98 | $expiration->add($time); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | protected function fixKey($key) { |
| 38 | - return "cache-" . $key; |
|
| 38 | + return "cache-".$key; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | $value = $this->memCached->get($this->fixKey($key)); |
| 71 | 71 | if ($this->memCached->getResultCode() !== Memcached::RES_SUCCESS) { |
| 72 | - $this->logger->info("[Memcached] Cache '$key' missed with status " . $this->memCached->getResultCode()); |
|
| 72 | + $this->logger->info("[Memcached] Cache '$key' missed with status ".$this->memCached->getResultCode()); |
|
| 73 | 73 | return $default; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | $this->lazyLoadMemCachedServers(); |
| 89 | 89 | |
| 90 | 90 | $this->memCached->set($this->fixKey($key), serialize($value), is_null($ttl) ? 0 : $ttl); |
| 91 | - $this->logger->info("[Memcached] Set '$key' result " . $this->memCached->getResultCode()); |
|
| 91 | + $this->logger->info("[Memcached] Set '$key' result ".$this->memCached->getResultCode()); |
|
| 92 | 92 | if ($this->memCached->getResultCode() !== Memcached::RES_SUCCESS) { |
| 93 | - $this->logger->error("[Memcached] Set '$key' failed with status " . $this->memCached->getResultCode()); |
|
| 93 | + $this->logger->error("[Memcached] Set '$key' failed with status ".$this->memCached->getResultCode()); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | return $this->memCached->getResultCode() === Memcached::RES_SUCCESS; |