@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function clearCache(string $cacheKey, string $namespace = '') |
69 | 69 | { |
70 | 70 | $data = $this->cacheRepository->clear($cacheKey, $namespace); |
71 | - if($data) { |
|
71 | + if ($data) { |
|
72 | 72 | $this->setMessage("Cache deleted successfully!", true); |
73 | 73 | } else { |
74 | 74 | $this->setMessage("Cache does not exists!", false); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function flushCache() |
84 | 84 | { |
85 | - if($this->cacheRepository->flush()){ |
|
85 | + if ($this->cacheRepository->flush()) { |
|
86 | 86 | $this->setMessage("Flush finished successfully", true); |
87 | 87 | } else { |
88 | 88 | $this->setMessage("Something went wrong. Please, try again.", false); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string|int $ttl |
99 | 99 | * @return mixed |
100 | 100 | */ |
101 | - public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600) |
|
101 | + public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600) |
|
102 | 102 | { |
103 | 103 | $cacheData = $this->retrieveCache($cacheKey, $namespace); |
104 | 104 | if ($cacheData) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param string|int $ttl |
118 | 118 | * @return array |
119 | 119 | */ |
120 | - public function getMany(array $cacheKeys, string $namespace = '', string|int $ttl = 3600) |
|
120 | + public function getMany(array $cacheKeys, string $namespace = '', string | int $ttl = 3600) |
|
121 | 121 | { |
122 | 122 | $cacheData = []; |
123 | 123 | foreach ($cacheKeys as $cacheKey) { |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | * @param string|int $ttl |
191 | 191 | * @return bool |
192 | 192 | */ |
193 | - public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string|int $ttl = 3600) |
|
193 | + public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string | int $ttl = 3600) |
|
194 | 194 | { |
195 | - if($this->storeCache($cacheKey, $cacheData, $namespace, $ttl)){ |
|
195 | + if ($this->storeCache($cacheKey, $cacheData, $namespace, $ttl)) { |
|
196 | 196 | $this->logger->debug("{$this->getMessage()} from database driver."); |
197 | 197 | return true; |
198 | 198 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | private function processBatchItems(array $batchItems, string $namespace) |
225 | 225 | { |
226 | - foreach($batchItems as $item) { |
|
226 | + foreach ($batchItems as $item) { |
|
227 | 227 | CacheDatabaseHelper::validateCacheItem($item); |
228 | 228 | $cacheKey = $item['cacheKey']; |
229 | 229 | $cacheData = $item['cacheData']; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @param string $namespace |
239 | 239 | * @return bool |
240 | 240 | */ |
241 | - private function renew(string $cacheKey, string|int $ttl = 3600, string $namespace = '') |
|
241 | + private function renew(string $cacheKey, string | int $ttl = 3600, string $namespace = '') |
|
242 | 242 | { |
243 | 243 | $cacheData = $this->getCache($cacheKey, $namespace); |
244 | 244 | if ($cacheData) { |
@@ -281,10 +281,10 @@ discard block |
||
281 | 281 | * @param integer $ttl |
282 | 282 | * @return bool |
283 | 283 | */ |
284 | - private function storeCache(string $cacheKey, mixed $cacheData, string $namespace = '', string|int $ttl = 3600) |
|
284 | + private function storeCache(string $cacheKey, mixed $cacheData, string $namespace = '', string | int $ttl = 3600) |
|
285 | 285 | { |
286 | 286 | $data = $this->cacheRepository->store($cacheKey, $cacheData, $namespace, $ttl); |
287 | - if($data) { |
|
287 | + if ($data) { |
|
288 | 288 | $this->setMessage("Cache Stored Successfully", true); |
289 | 289 | return true; |
290 | 290 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | private function updateCache(string $cacheKey, mixed $cacheData, string $namespace = '') |
302 | 302 | { |
303 | 303 | $data = $this->cacheRepository->update($cacheKey, $cacheData, $namespace); |
304 | - if($data) { |
|
304 | + if ($data) { |
|
305 | 305 | $this->setMessage("Cache updated successfully.", true); |
306 | 306 | return true; |
307 | 307 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param int|string $ttl |
71 | 71 | * @return bool |
72 | 72 | */ |
73 | - public function add(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600) |
|
73 | + public function add(string $cacheKey, mixed $cacheData, string $namespace = '', int | string $ttl = 3600) |
|
74 | 74 | { |
75 | 75 | if (!empty($this->getCache($cacheKey, $namespace))) { |
76 | 76 | return true; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param string|int $ttl |
161 | 161 | * @return CacheDataFormatter|mixed |
162 | 162 | */ |
163 | - public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600) |
|
163 | + public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600) |
|
164 | 164 | { |
165 | 165 | $cacheData = $this->cacheStore->getCache($cacheKey, $namespace, $ttl); |
166 | 166 | $this->setMessage($this->cacheStore->getMessage(), $this->cacheStore->isSuccess()); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @param string|int $ttl |
179 | 179 | * @return CacheDataFormatter|array |
180 | 180 | */ |
181 | - public function getMany(array $cacheKeys, string $namespace = '', string|int $ttl = 3600) |
|
181 | + public function getMany(array $cacheKeys, string $namespace = '', string | int $ttl = 3600) |
|
182 | 182 | { |
183 | 183 | $cachedData = $this->cacheStore->getMany($cacheKeys, $namespace, $ttl); |
184 | 184 | $this->setMessage($this->cacheStore->getMessage(), $this->cacheStore->isSuccess()); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | { |
214 | 214 | $cacheData = $this->getCache($cacheKey, $namespace); |
215 | 215 | |
216 | - if(!empty($cacheData) && is_numeric($cacheData)) { |
|
216 | + if (!empty($cacheData) && is_numeric($cacheData)) { |
|
217 | 217 | $this->putCache($cacheKey, (int)($cacheData + $amount), $namespace); |
218 | 218 | $this->setMessage($this->getMessage(), $this->isSuccess()); |
219 | 219 | return true; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @param string|int $ttl |
238 | 238 | * @return void |
239 | 239 | */ |
240 | - public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string|int $ttl = 3600) |
|
240 | + public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string | int $ttl = 3600) |
|
241 | 241 | { |
242 | 242 | $data = CacheerHelper::prepareForStorage($cacheData, $this->compression, $this->encryptionKey); |
243 | 243 | $this->cacheStore->putCache($cacheKey, $data, $namespace, $ttl); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @param string $namespace |
262 | 262 | * @return void |
263 | 263 | */ |
264 | - public function renewCache(string $cacheKey, string|int $ttl = 3600, string $namespace = '') |
|
264 | + public function renewCache(string $cacheKey, string | int $ttl = 3600, string $namespace = '') |
|
265 | 265 | { |
266 | 266 | $this->cacheStore->renewCache($cacheKey, $ttl, $namespace); |
267 | 267 | |
@@ -278,11 +278,11 @@ discard block |
||
278 | 278 | * @param Closure $callback |
279 | 279 | * @return mixed |
280 | 280 | */ |
281 | - public function remember(string $cacheKey, int|string $ttl, Closure $callback) |
|
281 | + public function remember(string $cacheKey, int | string $ttl, Closure $callback) |
|
282 | 282 | { |
283 | 283 | $cachedData = $this->getCache($cacheKey, ttl: $ttl); |
284 | 284 | |
285 | - if(!empty($cachedData)) { |
|
285 | + if (!empty($cachedData)) { |
|
286 | 286 | return $cachedData; |
287 | 287 | } |
288 | 288 |