@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string|int $ttl Lifetime in seconds (default: 3600) |
53 | 53 | * @return mixed Returns the cached data or null if not found |
54 | 54 | */ |
55 | - public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600); |
|
55 | + public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Retrieves multiple cache items by their keys. |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param string|int $ttl Lifetime in seconds (default: 3600) |
63 | 63 | * @return CacheDataFormatter Returns a formatter with the retrieved items |
64 | 64 | */ |
65 | - public function getMany(array $cacheKeys, string $namespace, string|int $ttl = 3600); |
|
65 | + public function getMany(array $cacheKeys, string $namespace, string | int $ttl = 3600); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Checks if a cache item exists. |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param string|int $ttl Lifetime in seconds (default: 3600) |
83 | 83 | * @return bool True on success, false on failure |
84 | 84 | */ |
85 | - public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600); |
|
85 | + public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int | string $ttl = 3600); |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Stores multiple items in the cache. |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param int|string $ttl |
143 | 143 | * @return mixed |
144 | 144 | */ |
145 | - public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600) |
|
145 | + public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600) |
|
146 | 146 | { |
147 | 147 | $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace); |
148 | 148 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @param string|int $ttl |
232 | 232 | * @return array |
233 | 233 | */ |
234 | - public function getMany(array $cacheKeys, string $namespace = '', string|int $ttl = 3600) |
|
234 | + public function getMany(array $cacheKeys, string $namespace = '', string | int $ttl = 3600) |
|
235 | 235 | { |
236 | 236 | $results = []; |
237 | 237 | foreach ($cacheKeys as $cacheKey) { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | { |
266 | 266 | $cacheData = $this->getCache($cacheKey, $namespace); |
267 | 267 | |
268 | - if(!empty($cacheData) && is_numeric($cacheData)) { |
|
268 | + if (!empty($cacheData) && is_numeric($cacheData)) { |
|
269 | 269 | $this->putCache($cacheKey, (int)($cacheData + $amount), $namespace); |
270 | 270 | $this->setMessage($this->getMessage(), $this->isSuccess()); |
271 | 271 | return true; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @param int|string $ttl |
304 | 304 | * @return bool |
305 | 305 | */ |
306 | - public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600) |
|
306 | + public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int | string $ttl = 3600) |
|
307 | 307 | { |
308 | 308 | $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace); |
309 | 309 | |
@@ -346,12 +346,12 @@ discard block |
||
346 | 346 | * @param string $namespace |
347 | 347 | * @return void |
348 | 348 | */ |
349 | - public function renewCache(string $cacheKey, int|string $ttl = 3600, string $namespace = '') |
|
349 | + public function renewCache(string $cacheKey, int | string $ttl = 3600, string $namespace = '') |
|
350 | 350 | { |
351 | 351 | $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace); |
352 | 352 | |
353 | 353 | if (isset($this->arrayStore[$arrayStoreKey])) { |
354 | - $ttlSeconds = is_numeric($ttl) ? (int) $ttl : strtotime($ttl) - time(); |
|
354 | + $ttlSeconds = is_numeric($ttl) ? (int)$ttl : strtotime($ttl) - time(); |
|
355 | 355 | $this->arrayStore[$arrayStoreKey]['expirationTime'] = time() + $ttlSeconds; |
356 | 356 | $this->setMessage("cacheKey: {$cacheKey} renewed successfully", true); |
357 | 357 | $this->logger->debug("{$this->getMessage()} from array driver."); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param int|string $ttl |
80 | 80 | * @return bool |
81 | 81 | */ |
82 | - public function add(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600) |
|
82 | + public function add(string $cacheKey, mixed $cacheData, string $namespace = '', int | string $ttl = 3600) |
|
83 | 83 | { |
84 | 84 | if (!empty($this->getCache($cacheKey, $namespace))) { |
85 | 85 | return true; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param string|int $ttl |
204 | 204 | * @return CacheDataFormatter|mixed |
205 | 205 | */ |
206 | - public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600) |
|
206 | + public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600) |
|
207 | 207 | { |
208 | 208 | $cacheData = $this->cacheStore->getCache($cacheKey, $namespace, $ttl); |
209 | 209 | $this->setMessage($this->cacheStore->getMessage(), $this->cacheStore->isSuccess()); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @param string|int $ttl |
224 | 224 | * @return CacheDataFormatter|array |
225 | 225 | */ |
226 | - public function getMany(array $cacheKeys, string $namespace = '', string|int $ttl = 3600) |
|
226 | + public function getMany(array $cacheKeys, string $namespace = '', string | int $ttl = 3600) |
|
227 | 227 | { |
228 | 228 | $cachedData = $this->cacheStore->getMany($cacheKeys, $namespace, $ttl); |
229 | 229 | $this->setMessage($this->cacheStore->getMessage(), $this->cacheStore->isSuccess()); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | { |
263 | 263 | $cacheData = $this->getCache($cacheKey, $namespace); |
264 | 264 | |
265 | - if(!empty($cacheData) && is_numeric($cacheData)) { |
|
265 | + if (!empty($cacheData) && is_numeric($cacheData)) { |
|
266 | 266 | $this->putCache($cacheKey, (int)($cacheData + $amount), $namespace); |
267 | 267 | $this->setMessage($this->getMessage(), $this->isSuccess()); |
268 | 268 | return true; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * @param string|int $ttl |
291 | 291 | * @return void |
292 | 292 | */ |
293 | - public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string|int $ttl = 3600) |
|
293 | + public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string | int $ttl = 3600) |
|
294 | 294 | { |
295 | 295 | $data = CacheerHelper::prepareForStorage($cacheData, $this->compression, $this->encryptionKey); |
296 | 296 | $this->cacheStore->putCache($cacheKey, $data, $namespace, $ttl); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @param string $namespace |
319 | 319 | * @return void |
320 | 320 | */ |
321 | - public function renewCache(string $cacheKey, string|int $ttl = 3600, string $namespace = '') |
|
321 | + public function renewCache(string $cacheKey, string | int $ttl = 3600, string $namespace = '') |
|
322 | 322 | { |
323 | 323 | $this->cacheStore->renewCache($cacheKey, $ttl, $namespace); |
324 | 324 | |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | * @param Closure $callback |
338 | 338 | * @return mixed |
339 | 339 | */ |
340 | - public function remember(string $cacheKey, int|string $ttl, Closure $callback) |
|
340 | + public function remember(string $cacheKey, int | string $ttl, Closure $callback) |
|
341 | 341 | { |
342 | 342 | $cachedData = $this->getCache($cacheKey, ttl: $ttl); |
343 | 343 | |
344 | - if(!empty($cachedData)) { |
|
344 | + if (!empty($cachedData)) { |
|
345 | 345 | return $cachedData; |
346 | 346 | } |
347 | 347 |