@@ -23,21 +23,21 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * Start cache. |
| 25 | 25 | * |
| 26 | - * @return PromiseInterface<CacheInterface> |
|
| 26 | + * @return PromiseInterface |
|
| 27 | 27 | */ |
| 28 | 28 | public function start(); |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Stop cache immediately. |
| 32 | 32 | * |
| 33 | - * @return PromiseInterface<CasheInterface> |
|
| 33 | + * @return PromiseInterface |
|
| 34 | 34 | */ |
| 35 | 35 | public function stop(); |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Stop accepting new requests immediately and stop cache after executing last pending request. |
| 39 | 39 | * |
| 40 | - * @return PromiseInterface<CasheInterface> |
|
| 40 | + * @return PromiseInterface |
|
| 41 | 41 | */ |
| 42 | 42 | public function end(); |
| 43 | 43 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @param string $key |
| 51 | 51 | * @param string|int|object|array $val |
| 52 | 52 | * @param float $ttl |
| 53 | - * @return PromiseInterface<mixed> |
|
| 53 | + * @return PromiseInterface |
|
| 54 | 54 | */ |
| 55 | 55 | public function set($key, $val, $ttl = 0.0); |
| 56 | 56 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * to other factors than ist not-being set. If the value is unset, the promise will resolve with null value. |
| 62 | 62 | * |
| 63 | 63 | * @param string $key |
| 64 | - * @return PromiseInterface<mixed|null> |
|
| 64 | + * @return PromiseInterface |
|
| 65 | 65 | */ |
| 66 | 66 | public function get($key); |
| 67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * Remove value stored under specified key. Returns true if key existed or false if did not. |
| 70 | 70 | * |
| 71 | 71 | * @param string $key |
| 72 | - * @return PromiseInterface<bool> |
|
| 72 | + * @return PromiseInterface |
|
| 73 | 73 | */ |
| 74 | 74 | public function remove($key); |
| 75 | 75 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * Check whether value exists. |
| 78 | 78 | * |
| 79 | 79 | * @param string $key |
| 80 | - * @return PromiseInterface<bool> |
|
| 80 | + * @return PromiseInterface |
|
| 81 | 81 | */ |
| 82 | 82 | public function exists($key); |
| 83 | 83 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @param string $key |
| 88 | 88 | * @param float $ttl |
| 89 | - * @return PromiseInterface<float> |
|
| 89 | + * @return PromiseInterface |
|
| 90 | 90 | */ |
| 91 | 91 | public function setTtl($key, $ttl); |
| 92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * Get TTL of already existing key. Returns 0 if there is no TTL. |
| 95 | 95 | * |
| 96 | 96 | * @param string $key |
| 97 | - * @return PromiseInterface<float> |
|
| 97 | + * @return PromiseInterface |
|
| 98 | 98 | */ |
| 99 | 99 | public function getTtl($key); |
| 100 | 100 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * Remove TTL of already existing key. Returns true if value existed or false if did not. |
| 103 | 103 | * |
| 104 | 104 | * @param string $key |
| 105 | - * @return PromiseInterface<bool> |
|
| 105 | + * @return PromiseInterface |
|
| 106 | 106 | */ |
| 107 | 107 | public function removeTtl($key); |
| 108 | 108 | |
@@ -110,28 +110,28 @@ discard block |
||
| 110 | 110 | * Check if TTL exists for specified key. |
| 111 | 111 | * |
| 112 | 112 | * @param string $key |
| 113 | - * @return PromiseInterface<bool> |
|
| 113 | + * @return PromiseInterface |
|
| 114 | 114 | */ |
| 115 | 115 | public function existsTtl($key); |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * Get existing keys. |
| 119 | 119 | * |
| 120 | - * @return PromiseInterface<string[]> |
|
| 120 | + * @return PromiseInterface |
|
| 121 | 121 | */ |
| 122 | 122 | public function getKeys(); |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * Get cache stats. |
| 126 | 126 | * |
| 127 | - * @return PromiseInterface<array> |
|
| 127 | + * @return PromiseInterface |
|
| 128 | 128 | */ |
| 129 | 129 | public function getStats(); |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | 132 | * Flush cache object. |
| 133 | 133 | * |
| 134 | - * @return PromiseInterface<void> |
|
| 134 | + * @return PromiseInterface |
|
| 135 | 135 | */ |
| 136 | 136 | public function flush(); |
| 137 | 137 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | if ($this->paused) |
| 191 | 191 | { |
| 192 | 192 | $this->paused = false; |
| 193 | - $this->loopTimer = $this->getLoop()->addPeriodicTimer($this->config['interval'], [ $this, 'handleTick' ]); |
|
| 193 | + $this->loopTimer = $this->getLoop()->addPeriodicTimer($this->config['interval'], [$this, 'handleTick']); |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | $timer = round($ttl / $this->config['interval']); |
| 284 | - $this->timers[$key] = [ 'timeout' => $timer, 'ttl' => $ttl ]; |
|
| 284 | + $this->timers[$key] = ['timeout' => $timer, 'ttl' => $ttl]; |
|
| 285 | 285 | $this->timersCounter++; |
| 286 | 286 | return Promise::doResolve($ttl); |
| 287 | 287 | } |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | */ |
| 401 | 401 | protected function createConfig($config = []) |
| 402 | 402 | { |
| 403 | - return array_merge([ 'interval' => 1e-1 ], $config); |
|
| 403 | + return array_merge(['interval' => 1e-1], $config); |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | protected function handleStart() |
| 410 | 410 | { |
| 411 | 411 | $this->resume(); |
| 412 | - $this->emit('start', [ $this ]); |
|
| 412 | + $this->emit('start', [$this]); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | /** |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | $this->endingPromises = []; |
| 431 | 431 | |
| 432 | - $this->emit('stop', [ $this ]); |
|
| 432 | + $this->emit('stop', [$this]); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -272,7 +272,8 @@ |
||
| 272 | 272 | { |
| 273 | 273 | return Promise::doReject(new WriteException('Cache object is not open.')); |
| 274 | 274 | } |
| 275 | - if ($ttl <= 0) { |
|
| 275 | + if ($ttl <= 0) |
|
| 276 | + { |
|
| 276 | 277 | return Promise::doReject(new WriteException('TTL needs to be higher than 0.')); |
| 277 | 278 | } |
| 278 | 279 | if (!array_key_exists($key, $this->storage)) |