@@ -22,13 +22,13 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | interface ClassNamespaceResolverInterface |
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * @return string |
|
| 27 | - */ |
|
| 28 | - public function getClassNamespace(): string; |
|
| 25 | + /** |
|
| 26 | + * @return string |
|
| 27 | + */ |
|
| 28 | + public function getClassNamespace(): string; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @return string |
|
| 32 | - */ |
|
| 33 | - public function getClassName(): string; |
|
| 30 | + /** |
|
| 31 | + * @return string |
|
| 32 | + */ |
|
| 33 | + public function getClassName(): string; |
|
| 34 | 34 | } |
@@ -27,141 +27,141 @@ |
||
| 27 | 27 | class ArrayObject implements ArrayAccess, Iterator, Countable |
| 28 | 28 | { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var array |
|
| 32 | - */ |
|
| 33 | - private $array; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @var int |
|
| 37 | - */ |
|
| 38 | - private $position = 0; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @param $args |
|
| 42 | - * ArrayObject constructor. |
|
| 43 | - */ |
|
| 44 | - public function __construct(...$args) |
|
| 45 | - { |
|
| 46 | - $this->array = (count($args) === 1 && is_array($args[0]) ? $args[0] : $args); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * @return mixed |
|
| 51 | - */ |
|
| 52 | - #[\ReturnTypeWillChange] // PHP 8.1 compatibility |
|
| 53 | - public function current() |
|
| 54 | - { |
|
| 55 | - return $this->array[$this->position]; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * |
|
| 60 | - */ |
|
| 61 | - public function next(): void |
|
| 62 | - { |
|
| 63 | - ++$this->position; |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * @return int |
|
| 68 | - */ |
|
| 69 | - public function key(): int |
|
| 70 | - { |
|
| 71 | - return $this->position; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * @return bool |
|
| 76 | - */ |
|
| 77 | - public function valid(): bool |
|
| 78 | - { |
|
| 79 | - return $this->offsetExists($this->position); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * @param mixed $offset |
|
| 84 | - * @return bool |
|
| 85 | - */ |
|
| 86 | - public function offsetExists($offset): bool |
|
| 87 | - { |
|
| 88 | - return array_key_exists($offset, $this->array); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * |
|
| 93 | - */ |
|
| 94 | - public function rewind(): void |
|
| 95 | - { |
|
| 96 | - $this->position = 0; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * @return int |
|
| 101 | - */ |
|
| 102 | - public function count(): int |
|
| 103 | - { |
|
| 104 | - return count($this->array); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * @param mixed $offset |
|
| 109 | - * @return mixed |
|
| 110 | - */ |
|
| 111 | - #[\ReturnTypeWillChange] // PHP 8.1 compatibility |
|
| 112 | - public function offsetGet($offset) |
|
| 113 | - { |
|
| 114 | - return $this->array[$offset] ?? null; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * @param mixed $offset |
|
| 119 | - * @param mixed $value |
|
| 120 | - */ |
|
| 121 | - public function offsetSet($offset, $value): void |
|
| 122 | - { |
|
| 123 | - // NOTE: THIS IS THE FIX FOR THE ISSUE "Indirect modification of overloaded element of SplFixedArray has no effect" |
|
| 124 | - // NOTE: WHEN APPENDING AN ARRAY (E.G. myArr[] = 5) THE KEY IS NULL, SO WE TEST FOR THIS CONDITION BELOW, AND VOILA |
|
| 125 | - |
|
| 126 | - if ($offset === null) { |
|
| 127 | - $this->array[] = $value; |
|
| 128 | - } else { |
|
| 129 | - $this->array[$offset] = $value; |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * @param mixed $offset |
|
| 135 | - */ |
|
| 136 | - public function offsetUnset($offset): void |
|
| 137 | - { |
|
| 138 | - unset($this->array[$offset]); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * @return array |
|
| 143 | - */ |
|
| 144 | - public function toArray(): array |
|
| 145 | - { |
|
| 146 | - return $this->array; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * @param array $array |
|
| 151 | - * @return self |
|
| 152 | - */ |
|
| 153 | - public function mergeArray(array $array): self |
|
| 154 | - { |
|
| 155 | - $this->array = array_merge($this->array, $array); |
|
| 156 | - |
|
| 157 | - return $this; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * @return array |
|
| 162 | - */ |
|
| 163 | - protected function &getArray(): array |
|
| 164 | - { |
|
| 165 | - return $this->array; |
|
| 166 | - } |
|
| 30 | + /** |
|
| 31 | + * @var array |
|
| 32 | + */ |
|
| 33 | + private $array; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @var int |
|
| 37 | + */ |
|
| 38 | + private $position = 0; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @param $args |
|
| 42 | + * ArrayObject constructor. |
|
| 43 | + */ |
|
| 44 | + public function __construct(...$args) |
|
| 45 | + { |
|
| 46 | + $this->array = (count($args) === 1 && is_array($args[0]) ? $args[0] : $args); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * @return mixed |
|
| 51 | + */ |
|
| 52 | + #[\ReturnTypeWillChange] // PHP 8.1 compatibility |
|
| 53 | + public function current() |
|
| 54 | + { |
|
| 55 | + return $this->array[$this->position]; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * |
|
| 60 | + */ |
|
| 61 | + public function next(): void |
|
| 62 | + { |
|
| 63 | + ++$this->position; |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * @return int |
|
| 68 | + */ |
|
| 69 | + public function key(): int |
|
| 70 | + { |
|
| 71 | + return $this->position; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * @return bool |
|
| 76 | + */ |
|
| 77 | + public function valid(): bool |
|
| 78 | + { |
|
| 79 | + return $this->offsetExists($this->position); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * @param mixed $offset |
|
| 84 | + * @return bool |
|
| 85 | + */ |
|
| 86 | + public function offsetExists($offset): bool |
|
| 87 | + { |
|
| 88 | + return array_key_exists($offset, $this->array); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * |
|
| 93 | + */ |
|
| 94 | + public function rewind(): void |
|
| 95 | + { |
|
| 96 | + $this->position = 0; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * @return int |
|
| 101 | + */ |
|
| 102 | + public function count(): int |
|
| 103 | + { |
|
| 104 | + return count($this->array); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * @param mixed $offset |
|
| 109 | + * @return mixed |
|
| 110 | + */ |
|
| 111 | + #[\ReturnTypeWillChange] // PHP 8.1 compatibility |
|
| 112 | + public function offsetGet($offset) |
|
| 113 | + { |
|
| 114 | + return $this->array[$offset] ?? null; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * @param mixed $offset |
|
| 119 | + * @param mixed $value |
|
| 120 | + */ |
|
| 121 | + public function offsetSet($offset, $value): void |
|
| 122 | + { |
|
| 123 | + // NOTE: THIS IS THE FIX FOR THE ISSUE "Indirect modification of overloaded element of SplFixedArray has no effect" |
|
| 124 | + // NOTE: WHEN APPENDING AN ARRAY (E.G. myArr[] = 5) THE KEY IS NULL, SO WE TEST FOR THIS CONDITION BELOW, AND VOILA |
|
| 125 | + |
|
| 126 | + if ($offset === null) { |
|
| 127 | + $this->array[] = $value; |
|
| 128 | + } else { |
|
| 129 | + $this->array[$offset] = $value; |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * @param mixed $offset |
|
| 135 | + */ |
|
| 136 | + public function offsetUnset($offset): void |
|
| 137 | + { |
|
| 138 | + unset($this->array[$offset]); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * @return array |
|
| 143 | + */ |
|
| 144 | + public function toArray(): array |
|
| 145 | + { |
|
| 146 | + return $this->array; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * @param array $array |
|
| 151 | + * @return self |
|
| 152 | + */ |
|
| 153 | + public function mergeArray(array $array): self |
|
| 154 | + { |
|
| 155 | + $this->array = array_merge($this->array, $array); |
|
| 156 | + |
|
| 157 | + return $this; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * @return array |
|
| 162 | + */ |
|
| 163 | + protected function &getArray(): array |
|
| 164 | + { |
|
| 165 | + return $this->array; |
|
| 166 | + } |
|
| 167 | 167 | } |
@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | * @param $args |
| 42 | 42 | * ArrayObject constructor. |
| 43 | 43 | */ |
| 44 | - public function __construct(...$args) |
|
| 45 | - { |
|
| 44 | + public function __construct(...$args) { |
|
| 46 | 45 | $this->array = (count($args) === 1 && is_array($args[0]) ? $args[0] : $args); |
| 47 | 46 | } |
| 48 | 47 | |
@@ -50,8 +49,7 @@ discard block |
||
| 50 | 49 | * @return mixed |
| 51 | 50 | */ |
| 52 | 51 | #[\ReturnTypeWillChange] // PHP 8.1 compatibility |
| 53 | - public function current() |
|
| 54 | - { |
|
| 52 | + public function current() { |
|
| 55 | 53 | return $this->array[$this->position]; |
| 56 | 54 | } |
| 57 | 55 | |
@@ -109,8 +107,7 @@ discard block |
||
| 109 | 107 | * @return mixed |
| 110 | 108 | */ |
| 111 | 109 | #[\ReturnTypeWillChange] // PHP 8.1 compatibility |
| 112 | - public function offsetGet($offset) |
|
| 113 | - { |
|
| 110 | + public function offsetGet($offset) { |
|
| 114 | 111 | return $this->array[$offset] ?? null; |
| 115 | 112 | } |
| 116 | 113 | |
@@ -125,7 +122,8 @@ discard block |
||
| 125 | 122 | |
| 126 | 123 | if ($offset === null) { |
| 127 | 124 | $this->array[] = $value; |
| 128 | - } else { |
|
| 125 | + } |
|
| 126 | + else { |
|
| 129 | 127 | $this->array[$offset] = $value; |
| 130 | 128 | } |
| 131 | 129 | } |
@@ -25,60 +25,60 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | interface TaggableCacheItemInterface |
| 27 | 27 | { |
| 28 | - /** |
|
| 29 | - * @param string $tagName |
|
| 30 | - * |
|
| 31 | - * @return ExtendedCacheItemInterface |
|
| 32 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 33 | - */ |
|
| 34 | - public function addTag(string $tagName): ExtendedCacheItemInterface; |
|
| 28 | + /** |
|
| 29 | + * @param string $tagName |
|
| 30 | + * |
|
| 31 | + * @return ExtendedCacheItemInterface |
|
| 32 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 33 | + */ |
|
| 34 | + public function addTag(string $tagName): ExtendedCacheItemInterface; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @param array $tagNames |
|
| 38 | - * |
|
| 39 | - * @return ExtendedCacheItemInterface |
|
| 40 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 41 | - */ |
|
| 42 | - public function addTags(array $tagNames): ExtendedCacheItemInterface; |
|
| 36 | + /** |
|
| 37 | + * @param array $tagNames |
|
| 38 | + * |
|
| 39 | + * @return ExtendedCacheItemInterface |
|
| 40 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 41 | + */ |
|
| 42 | + public function addTags(array $tagNames): ExtendedCacheItemInterface; |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @param array $tags |
|
| 47 | - * |
|
| 48 | - * @return ExtendedCacheItemInterface |
|
| 49 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 50 | - */ |
|
| 51 | - public function setTags(array $tags): ExtendedCacheItemInterface; |
|
| 45 | + /** |
|
| 46 | + * @param array $tags |
|
| 47 | + * |
|
| 48 | + * @return ExtendedCacheItemInterface |
|
| 49 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 50 | + */ |
|
| 51 | + public function setTags(array $tags): ExtendedCacheItemInterface; |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @return array |
|
| 55 | - */ |
|
| 56 | - public function getTags(): array; |
|
| 53 | + /** |
|
| 54 | + * @return array |
|
| 55 | + */ |
|
| 56 | + public function getTags(): array; |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @param string $separator |
|
| 60 | - * |
|
| 61 | - * @return string |
|
| 62 | - */ |
|
| 63 | - public function getTagsAsString(string $separator = ', '): string; |
|
| 58 | + /** |
|
| 59 | + * @param string $separator |
|
| 60 | + * |
|
| 61 | + * @return string |
|
| 62 | + */ |
|
| 63 | + public function getTagsAsString(string $separator = ', '): string; |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * @param string $tagName |
|
| 67 | - * |
|
| 68 | - * @return ExtendedCacheItemInterface |
|
| 69 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 70 | - */ |
|
| 71 | - public function removeTag(string $tagName): ExtendedCacheItemInterface; |
|
| 65 | + /** |
|
| 66 | + * @param string $tagName |
|
| 67 | + * |
|
| 68 | + * @return ExtendedCacheItemInterface |
|
| 69 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 70 | + */ |
|
| 71 | + public function removeTag(string $tagName): ExtendedCacheItemInterface; |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * @param array $tagNames |
|
| 75 | - * |
|
| 76 | - * @return ExtendedCacheItemInterface |
|
| 77 | - */ |
|
| 78 | - public function removeTags(array $tagNames): ExtendedCacheItemInterface; |
|
| 73 | + /** |
|
| 74 | + * @param array $tagNames |
|
| 75 | + * |
|
| 76 | + * @return ExtendedCacheItemInterface |
|
| 77 | + */ |
|
| 78 | + public function removeTags(array $tagNames): ExtendedCacheItemInterface; |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * @return array |
|
| 82 | - */ |
|
| 83 | - public function getRemovedTags(): array; |
|
| 80 | + /** |
|
| 81 | + * @return array |
|
| 82 | + */ |
|
| 83 | + public function getRemovedTags(): array; |
|
| 84 | 84 | } |
@@ -32,155 +32,155 @@ |
||
| 32 | 32 | interface ExtendedCacheItemInterface extends CacheItemInterface, EventManagerDispatcherInterface, ClassNamespaceResolverInterface, JsonSerializable, TaggableCacheItemInterface |
| 33 | 33 | { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Returns the encoded key for the current cache item. |
|
| 37 | - * Is a MD5 (default),SHA1,SHA256 hash if "defaultKeyHashFunction" config option is configured |
|
| 38 | - * Else return the plain cache item key "defaultKeyHashFunction" config option is emptied |
|
| 39 | - * |
|
| 40 | - * @return string |
|
| 41 | - * The encoded key string for this cache item. |
|
| 42 | - */ |
|
| 43 | - public function getEncodedKey(): string; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @return DateTimeInterface |
|
| 47 | - */ |
|
| 48 | - public function getExpirationDate(): DateTimeInterface; |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * Alias of expireAt() with forced $expiration param |
|
| 52 | - * |
|
| 53 | - * @param DateTimeInterface $expiration |
|
| 54 | - * The point in time after which the item MUST be considered expired. |
|
| 55 | - * If null is passed explicitly, a default value MAY be used. If none is set, |
|
| 56 | - * the value should be stored permanently or for as long as the |
|
| 57 | - * implementation allows. |
|
| 58 | - * |
|
| 59 | - * @return ExtendedCacheItemInterface |
|
| 60 | - * The called object. |
|
| 61 | - */ |
|
| 62 | - public function setExpirationDate(DateTimeInterface $expiration): ExtendedCacheItemInterface; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * @return DateTimeInterface |
|
| 66 | - * @throws PhpfastcacheLogicException |
|
| 67 | - */ |
|
| 68 | - public function getCreationDate(): DateTimeInterface; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * @return DateTimeInterface |
|
| 72 | - * @throws PhpfastcacheLogicException |
|
| 73 | - */ |
|
| 74 | - public function getModificationDate(): DateTimeInterface; |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * @param $date DateTimeInterface |
|
| 78 | - * |
|
| 79 | - * @return ExtendedCacheItemInterface |
|
| 80 | - * @throws PhpfastcacheLogicException |
|
| 81 | - */ |
|
| 82 | - public function setCreationDate(DateTimeInterface $date): ExtendedCacheItemInterface; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * @param $date DateTimeInterface |
|
| 86 | - * |
|
| 87 | - * @return ExtendedCacheItemInterface |
|
| 88 | - * @throws PhpfastcacheLogicException |
|
| 89 | - */ |
|
| 90 | - public function setModificationDate(DateTimeInterface $date): ExtendedCacheItemInterface; |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * @return int |
|
| 94 | - */ |
|
| 95 | - public function getTtl(): int; |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * @return bool |
|
| 99 | - */ |
|
| 100 | - public function isExpired(): bool; |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * @return bool |
|
| 104 | - */ |
|
| 105 | - public function isNull(): bool; |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * @return bool |
|
| 109 | - */ |
|
| 110 | - public function isEmpty(): bool; |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * Return the data length: |
|
| 114 | - * - Either the number of char if it's a string (binary mode) |
|
| 115 | - * - or the number of element if it's an array |
|
| 116 | - * - or the number returned by count() if it's an object implementing \Countable interface |
|
| 117 | - * - or -1 for anything else |
|
| 118 | - * |
|
| 119 | - * @return int |
|
| 120 | - */ |
|
| 121 | - public function getLength(): int; |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * @param ExtendedCacheItemPoolInterface $driver |
|
| 125 | - * |
|
| 126 | - * @return mixed |
|
| 127 | - */ |
|
| 128 | - public function setDriver(ExtendedCacheItemPoolInterface $driver); |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * @param bool $isHit |
|
| 132 | - * |
|
| 133 | - * @return ExtendedCacheItemInterface |
|
| 134 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 135 | - */ |
|
| 136 | - public function setHit($isHit): ExtendedCacheItemInterface; |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * @param int $step |
|
| 140 | - * |
|
| 141 | - * @return ExtendedCacheItemInterface |
|
| 142 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 143 | - */ |
|
| 144 | - public function increment($step = 1): ExtendedCacheItemInterface; |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * @param int $step |
|
| 148 | - * |
|
| 149 | - * @return ExtendedCacheItemInterface |
|
| 150 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 151 | - */ |
|
| 152 | - public function decrement($step = 1): ExtendedCacheItemInterface; |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * @param array|string $data |
|
| 156 | - * |
|
| 157 | - * @return ExtendedCacheItemInterface |
|
| 158 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 159 | - */ |
|
| 160 | - public function append($data): ExtendedCacheItemInterface; |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * @param array|string $data |
|
| 164 | - * |
|
| 165 | - * @return ExtendedCacheItemInterface |
|
| 166 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 167 | - */ |
|
| 168 | - public function prepend($data): ExtendedCacheItemInterface; |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Return the data as a well-formatted string. |
|
| 172 | - * Any scalar value will be casted to an array |
|
| 173 | - * |
|
| 174 | - * @param int $option \json_encode() options |
|
| 175 | - * @param int $depth \json_encode() depth |
|
| 176 | - * |
|
| 177 | - * @return string |
|
| 178 | - */ |
|
| 179 | - public function getDataAsJsonString(int $option = 0, int $depth = 512): string; |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * @param ExtendedCacheItemPoolInterface $driverPool |
|
| 183 | - * @return bool |
|
| 184 | - */ |
|
| 185 | - public function doesItemBelongToThatDriverBackend(ExtendedCacheItemPoolInterface $driverPool): bool; |
|
| 35 | + /** |
|
| 36 | + * Returns the encoded key for the current cache item. |
|
| 37 | + * Is a MD5 (default),SHA1,SHA256 hash if "defaultKeyHashFunction" config option is configured |
|
| 38 | + * Else return the plain cache item key "defaultKeyHashFunction" config option is emptied |
|
| 39 | + * |
|
| 40 | + * @return string |
|
| 41 | + * The encoded key string for this cache item. |
|
| 42 | + */ |
|
| 43 | + public function getEncodedKey(): string; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @return DateTimeInterface |
|
| 47 | + */ |
|
| 48 | + public function getExpirationDate(): DateTimeInterface; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * Alias of expireAt() with forced $expiration param |
|
| 52 | + * |
|
| 53 | + * @param DateTimeInterface $expiration |
|
| 54 | + * The point in time after which the item MUST be considered expired. |
|
| 55 | + * If null is passed explicitly, a default value MAY be used. If none is set, |
|
| 56 | + * the value should be stored permanently or for as long as the |
|
| 57 | + * implementation allows. |
|
| 58 | + * |
|
| 59 | + * @return ExtendedCacheItemInterface |
|
| 60 | + * The called object. |
|
| 61 | + */ |
|
| 62 | + public function setExpirationDate(DateTimeInterface $expiration): ExtendedCacheItemInterface; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @return DateTimeInterface |
|
| 66 | + * @throws PhpfastcacheLogicException |
|
| 67 | + */ |
|
| 68 | + public function getCreationDate(): DateTimeInterface; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * @return DateTimeInterface |
|
| 72 | + * @throws PhpfastcacheLogicException |
|
| 73 | + */ |
|
| 74 | + public function getModificationDate(): DateTimeInterface; |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * @param $date DateTimeInterface |
|
| 78 | + * |
|
| 79 | + * @return ExtendedCacheItemInterface |
|
| 80 | + * @throws PhpfastcacheLogicException |
|
| 81 | + */ |
|
| 82 | + public function setCreationDate(DateTimeInterface $date): ExtendedCacheItemInterface; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @param $date DateTimeInterface |
|
| 86 | + * |
|
| 87 | + * @return ExtendedCacheItemInterface |
|
| 88 | + * @throws PhpfastcacheLogicException |
|
| 89 | + */ |
|
| 90 | + public function setModificationDate(DateTimeInterface $date): ExtendedCacheItemInterface; |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * @return int |
|
| 94 | + */ |
|
| 95 | + public function getTtl(): int; |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * @return bool |
|
| 99 | + */ |
|
| 100 | + public function isExpired(): bool; |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * @return bool |
|
| 104 | + */ |
|
| 105 | + public function isNull(): bool; |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * @return bool |
|
| 109 | + */ |
|
| 110 | + public function isEmpty(): bool; |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * Return the data length: |
|
| 114 | + * - Either the number of char if it's a string (binary mode) |
|
| 115 | + * - or the number of element if it's an array |
|
| 116 | + * - or the number returned by count() if it's an object implementing \Countable interface |
|
| 117 | + * - or -1 for anything else |
|
| 118 | + * |
|
| 119 | + * @return int |
|
| 120 | + */ |
|
| 121 | + public function getLength(): int; |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * @param ExtendedCacheItemPoolInterface $driver |
|
| 125 | + * |
|
| 126 | + * @return mixed |
|
| 127 | + */ |
|
| 128 | + public function setDriver(ExtendedCacheItemPoolInterface $driver); |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * @param bool $isHit |
|
| 132 | + * |
|
| 133 | + * @return ExtendedCacheItemInterface |
|
| 134 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 135 | + */ |
|
| 136 | + public function setHit($isHit): ExtendedCacheItemInterface; |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * @param int $step |
|
| 140 | + * |
|
| 141 | + * @return ExtendedCacheItemInterface |
|
| 142 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 143 | + */ |
|
| 144 | + public function increment($step = 1): ExtendedCacheItemInterface; |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * @param int $step |
|
| 148 | + * |
|
| 149 | + * @return ExtendedCacheItemInterface |
|
| 150 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 151 | + */ |
|
| 152 | + public function decrement($step = 1): ExtendedCacheItemInterface; |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * @param array|string $data |
|
| 156 | + * |
|
| 157 | + * @return ExtendedCacheItemInterface |
|
| 158 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 159 | + */ |
|
| 160 | + public function append($data): ExtendedCacheItemInterface; |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * @param array|string $data |
|
| 164 | + * |
|
| 165 | + * @return ExtendedCacheItemInterface |
|
| 166 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 167 | + */ |
|
| 168 | + public function prepend($data): ExtendedCacheItemInterface; |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Return the data as a well-formatted string. |
|
| 172 | + * Any scalar value will be casted to an array |
|
| 173 | + * |
|
| 174 | + * @param int $option \json_encode() options |
|
| 175 | + * @param int $depth \json_encode() depth |
|
| 176 | + * |
|
| 177 | + * @return string |
|
| 178 | + */ |
|
| 179 | + public function getDataAsJsonString(int $option = 0, int $depth = 512): string; |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * @param ExtendedCacheItemPoolInterface $driverPool |
|
| 183 | + * @return bool |
|
| 184 | + */ |
|
| 185 | + public function doesItemBelongToThatDriverBackend(ExtendedCacheItemPoolInterface $driverPool): bool; |
|
| 186 | 186 | } |
@@ -26,103 +26,103 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | trait TaggableCacheItemTrait |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * @param array $tagNames |
|
| 31 | - * @return ExtendedCacheItemInterface |
|
| 32 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 33 | - */ |
|
| 34 | - public function addTags(array $tagNames): ExtendedCacheItemInterface |
|
| 35 | - { |
|
| 36 | - foreach ($tagNames as $tagName) { |
|
| 37 | - $this->addTag($tagName); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - return $this; |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * @param $tagName |
|
| 45 | - * @return ExtendedCacheItemInterface |
|
| 46 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 47 | - */ |
|
| 48 | - public function addTag(string $tagName): ExtendedCacheItemInterface |
|
| 49 | - { |
|
| 50 | - if (\is_string($tagName)) { |
|
| 51 | - $this->tags = \array_unique(\array_merge($this->tags, [$tagName])); |
|
| 52 | - |
|
| 53 | - return $this; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - throw new PhpfastcacheInvalidArgumentException('$tagName must be a string'); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @param array $tags |
|
| 61 | - * @return ExtendedCacheItemInterface |
|
| 62 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 63 | - */ |
|
| 64 | - public function setTags(array $tags): ExtendedCacheItemInterface |
|
| 65 | - { |
|
| 66 | - if (\count($tags)) { |
|
| 67 | - if (\array_filter($tags, 'is_string')) { |
|
| 68 | - $this->tags = $tags; |
|
| 69 | - } else { |
|
| 70 | - throw new PhpfastcacheInvalidArgumentException('$tagName must be an array of string'); |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - return $this; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * @return array |
|
| 79 | - */ |
|
| 80 | - public function getTags(): array |
|
| 81 | - { |
|
| 82 | - return $this->tags; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * @param string $separator |
|
| 87 | - * @return string |
|
| 88 | - */ |
|
| 89 | - public function getTagsAsString(string $separator = ', '): string |
|
| 90 | - { |
|
| 91 | - return \implode($separator, $this->tags); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * @param array $tagNames |
|
| 96 | - * @return ExtendedCacheItemInterface |
|
| 97 | - */ |
|
| 98 | - public function removeTags(array $tagNames): ExtendedCacheItemInterface |
|
| 99 | - { |
|
| 100 | - foreach ($tagNames as $tagName) { |
|
| 101 | - $this->removeTag($tagName); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - return $this; |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * @param $tagName |
|
| 109 | - * @return ExtendedCacheItemInterface |
|
| 110 | - */ |
|
| 111 | - public function removeTag(string $tagName): ExtendedCacheItemInterface |
|
| 112 | - { |
|
| 113 | - if (($key = \array_search($tagName, $this->tags, true)) !== false) { |
|
| 114 | - unset($this->tags[$key]); |
|
| 115 | - $this->removedTags[] = $tagName; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - return $this; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * @return array |
|
| 123 | - */ |
|
| 124 | - public function getRemovedTags(): array |
|
| 125 | - { |
|
| 126 | - return \array_diff($this->removedTags, $this->tags); |
|
| 127 | - } |
|
| 29 | + /** |
|
| 30 | + * @param array $tagNames |
|
| 31 | + * @return ExtendedCacheItemInterface |
|
| 32 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 33 | + */ |
|
| 34 | + public function addTags(array $tagNames): ExtendedCacheItemInterface |
|
| 35 | + { |
|
| 36 | + foreach ($tagNames as $tagName) { |
|
| 37 | + $this->addTag($tagName); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + return $this; |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @param $tagName |
|
| 45 | + * @return ExtendedCacheItemInterface |
|
| 46 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 47 | + */ |
|
| 48 | + public function addTag(string $tagName): ExtendedCacheItemInterface |
|
| 49 | + { |
|
| 50 | + if (\is_string($tagName)) { |
|
| 51 | + $this->tags = \array_unique(\array_merge($this->tags, [$tagName])); |
|
| 52 | + |
|
| 53 | + return $this; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + throw new PhpfastcacheInvalidArgumentException('$tagName must be a string'); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @param array $tags |
|
| 61 | + * @return ExtendedCacheItemInterface |
|
| 62 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 63 | + */ |
|
| 64 | + public function setTags(array $tags): ExtendedCacheItemInterface |
|
| 65 | + { |
|
| 66 | + if (\count($tags)) { |
|
| 67 | + if (\array_filter($tags, 'is_string')) { |
|
| 68 | + $this->tags = $tags; |
|
| 69 | + } else { |
|
| 70 | + throw new PhpfastcacheInvalidArgumentException('$tagName must be an array of string'); |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + return $this; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * @return array |
|
| 79 | + */ |
|
| 80 | + public function getTags(): array |
|
| 81 | + { |
|
| 82 | + return $this->tags; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * @param string $separator |
|
| 87 | + * @return string |
|
| 88 | + */ |
|
| 89 | + public function getTagsAsString(string $separator = ', '): string |
|
| 90 | + { |
|
| 91 | + return \implode($separator, $this->tags); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * @param array $tagNames |
|
| 96 | + * @return ExtendedCacheItemInterface |
|
| 97 | + */ |
|
| 98 | + public function removeTags(array $tagNames): ExtendedCacheItemInterface |
|
| 99 | + { |
|
| 100 | + foreach ($tagNames as $tagName) { |
|
| 101 | + $this->removeTag($tagName); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + return $this; |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * @param $tagName |
|
| 109 | + * @return ExtendedCacheItemInterface |
|
| 110 | + */ |
|
| 111 | + public function removeTag(string $tagName): ExtendedCacheItemInterface |
|
| 112 | + { |
|
| 113 | + if (($key = \array_search($tagName, $this->tags, true)) !== false) { |
|
| 114 | + unset($this->tags[$key]); |
|
| 115 | + $this->removedTags[] = $tagName; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + return $this; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * @return array |
|
| 123 | + */ |
|
| 124 | + public function getRemovedTags(): array |
|
| 125 | + { |
|
| 126 | + return \array_diff($this->removedTags, $this->tags); |
|
| 127 | + } |
|
| 128 | 128 | } |
@@ -66,7 +66,8 @@ |
||
| 66 | 66 | if (\count($tags)) { |
| 67 | 67 | if (\array_filter($tags, 'is_string')) { |
| 68 | 68 | $this->tags = $tags; |
| 69 | - } else { |
|
| 69 | + } |
|
| 70 | + else { |
|
| 70 | 71 | throw new PhpfastcacheInvalidArgumentException('$tagName must be an array of string'); |
| 71 | 72 | } |
| 72 | 73 | } |
@@ -29,186 +29,186 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | trait ItemBaseTrait |
| 31 | 31 | { |
| 32 | - use ItemExtendedTrait; |
|
| 33 | - use EventManagerDispatcherTrait; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @var bool |
|
| 37 | - */ |
|
| 38 | - protected $fetched = false; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @var string |
|
| 42 | - */ |
|
| 43 | - protected $key; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @var mixed |
|
| 47 | - */ |
|
| 48 | - protected $data; |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @var DateTimeInterface |
|
| 52 | - */ |
|
| 53 | - protected $expirationDate; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * @var DateTimeInterface |
|
| 57 | - */ |
|
| 58 | - protected $creationDate; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * @var DateTimeInterface |
|
| 62 | - */ |
|
| 63 | - protected $modificationDate; |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * @var array |
|
| 67 | - */ |
|
| 68 | - protected $tags = []; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * @var array |
|
| 72 | - */ |
|
| 73 | - protected $removedTags = []; |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * @var bool |
|
| 77 | - */ |
|
| 78 | - protected $isHit = false; |
|
| 79 | - |
|
| 80 | - /******************** |
|
| 32 | + use ItemExtendedTrait; |
|
| 33 | + use EventManagerDispatcherTrait; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @var bool |
|
| 37 | + */ |
|
| 38 | + protected $fetched = false; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @var string |
|
| 42 | + */ |
|
| 43 | + protected $key; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @var mixed |
|
| 47 | + */ |
|
| 48 | + protected $data; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @var DateTimeInterface |
|
| 52 | + */ |
|
| 53 | + protected $expirationDate; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * @var DateTimeInterface |
|
| 57 | + */ |
|
| 58 | + protected $creationDate; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * @var DateTimeInterface |
|
| 62 | + */ |
|
| 63 | + protected $modificationDate; |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * @var array |
|
| 67 | + */ |
|
| 68 | + protected $tags = []; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * @var array |
|
| 72 | + */ |
|
| 73 | + protected $removedTags = []; |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * @var bool |
|
| 77 | + */ |
|
| 78 | + protected $isHit = false; |
|
| 79 | + |
|
| 80 | + /******************** |
|
| 81 | 81 | * |
| 82 | 82 | * PSR-6 Methods |
| 83 | 83 | * |
| 84 | 84 | *******************/ |
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * @return string |
|
| 88 | - */ |
|
| 89 | - public function getKey() |
|
| 90 | - { |
|
| 91 | - return $this->key; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * @return mixed |
|
| 96 | - */ |
|
| 97 | - public function get() |
|
| 98 | - { |
|
| 99 | - return $this->data; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * @param mixed $value |
|
| 104 | - * @return $this |
|
| 105 | - */ |
|
| 106 | - public function set($value) |
|
| 107 | - { |
|
| 108 | - /** |
|
| 109 | - * The user set a value, |
|
| 110 | - * therefore there is no need to |
|
| 111 | - * fetch from source anymore |
|
| 112 | - */ |
|
| 113 | - $this->fetched = true; |
|
| 114 | - $this->data = $value; |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * @eventName CacheSaveDeferredItem |
|
| 118 | - * @param ExtendedCacheItemInterface $this |
|
| 119 | - * @param mixed $value |
|
| 120 | - * |
|
| 121 | - */ |
|
| 122 | - $this->eventManager->dispatch('CacheItemSet', $this, $value); |
|
| 123 | - |
|
| 124 | - return $this; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * @return bool |
|
| 129 | - */ |
|
| 130 | - public function isHit(): bool |
|
| 131 | - { |
|
| 132 | - return $this->isHit; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * @param bool $isHit |
|
| 137 | - * @return ExtendedCacheItemInterface |
|
| 138 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 139 | - */ |
|
| 140 | - public function setHit($isHit): ExtendedCacheItemInterface |
|
| 141 | - { |
|
| 142 | - if (\is_bool($isHit)) { |
|
| 143 | - $this->isHit = $isHit; |
|
| 144 | - |
|
| 145 | - return $this; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - throw new PhpfastcacheInvalidArgumentException('$isHit must be a boolean'); |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * @param DateTimeInterface $expiration |
|
| 153 | - * @return ExtendedCacheItemInterface |
|
| 154 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 155 | - */ |
|
| 156 | - public function expiresAt($expiration): ExtendedCacheItemInterface |
|
| 157 | - { |
|
| 158 | - if ($expiration instanceof DateTimeInterface) { |
|
| 159 | - /** |
|
| 160 | - * @eventName CacheItemExpireAt |
|
| 161 | - * @param ExtendedCacheItemInterface $this |
|
| 162 | - * @param DateTimeInterface $expiration |
|
| 163 | - */ |
|
| 164 | - $this->eventManager->dispatch('CacheItemExpireAt', $this, $expiration); |
|
| 165 | - $this->expirationDate = $expiration; |
|
| 166 | - } else { |
|
| 167 | - throw new PhpfastcacheInvalidArgumentException('$expiration must be an object implementing the DateTimeInterface got: ' . \gettype($expiration)); |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - return $this; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * @param DateInterval|int $time |
|
| 175 | - * @return $this |
|
| 176 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 177 | - */ |
|
| 178 | - public function expiresAfter($time) |
|
| 179 | - { |
|
| 180 | - if (\is_numeric($time)) { |
|
| 181 | - if ($time <= 0) { |
|
| 182 | - /** |
|
| 183 | - * 5 years, however memcached or memory cached will gone when u restart it |
|
| 184 | - * just recommended for sqlite. files |
|
| 185 | - */ |
|
| 186 | - $time = 30 * 24 * 3600 * 5; |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * @eventName CacheItemExpireAt |
|
| 191 | - * @param ExtendedCacheItemInterface $this |
|
| 192 | - * @param DateTimeInterface $expiration |
|
| 193 | - */ |
|
| 194 | - $this->eventManager->dispatch('CacheItemExpireAfter', $this, $time); |
|
| 195 | - |
|
| 196 | - $this->expirationDate = (new DateTime())->add(new DateInterval(\sprintf('PT%dS', $time))); |
|
| 197 | - } else { |
|
| 198 | - if ($time instanceof DateInterval) { |
|
| 199 | - /** |
|
| 200 | - * @eventName CacheItemExpireAt |
|
| 201 | - * @param ExtendedCacheItemInterface $this |
|
| 202 | - * @param DateTimeInterface $expiration |
|
| 203 | - */ |
|
| 204 | - $this->eventManager->dispatch('CacheItemExpireAfter', $this, $time); |
|
| 205 | - |
|
| 206 | - $this->expirationDate = (new DateTime())->add($time); |
|
| 207 | - } else { |
|
| 208 | - throw new PhpfastcacheInvalidArgumentException(\sprintf('Invalid date format, got "%s"', \gettype($time))); |
|
| 209 | - } |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - return $this; |
|
| 213 | - } |
|
| 86 | + /** |
|
| 87 | + * @return string |
|
| 88 | + */ |
|
| 89 | + public function getKey() |
|
| 90 | + { |
|
| 91 | + return $this->key; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * @return mixed |
|
| 96 | + */ |
|
| 97 | + public function get() |
|
| 98 | + { |
|
| 99 | + return $this->data; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * @param mixed $value |
|
| 104 | + * @return $this |
|
| 105 | + */ |
|
| 106 | + public function set($value) |
|
| 107 | + { |
|
| 108 | + /** |
|
| 109 | + * The user set a value, |
|
| 110 | + * therefore there is no need to |
|
| 111 | + * fetch from source anymore |
|
| 112 | + */ |
|
| 113 | + $this->fetched = true; |
|
| 114 | + $this->data = $value; |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * @eventName CacheSaveDeferredItem |
|
| 118 | + * @param ExtendedCacheItemInterface $this |
|
| 119 | + * @param mixed $value |
|
| 120 | + * |
|
| 121 | + */ |
|
| 122 | + $this->eventManager->dispatch('CacheItemSet', $this, $value); |
|
| 123 | + |
|
| 124 | + return $this; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * @return bool |
|
| 129 | + */ |
|
| 130 | + public function isHit(): bool |
|
| 131 | + { |
|
| 132 | + return $this->isHit; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * @param bool $isHit |
|
| 137 | + * @return ExtendedCacheItemInterface |
|
| 138 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 139 | + */ |
|
| 140 | + public function setHit($isHit): ExtendedCacheItemInterface |
|
| 141 | + { |
|
| 142 | + if (\is_bool($isHit)) { |
|
| 143 | + $this->isHit = $isHit; |
|
| 144 | + |
|
| 145 | + return $this; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + throw new PhpfastcacheInvalidArgumentException('$isHit must be a boolean'); |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * @param DateTimeInterface $expiration |
|
| 153 | + * @return ExtendedCacheItemInterface |
|
| 154 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 155 | + */ |
|
| 156 | + public function expiresAt($expiration): ExtendedCacheItemInterface |
|
| 157 | + { |
|
| 158 | + if ($expiration instanceof DateTimeInterface) { |
|
| 159 | + /** |
|
| 160 | + * @eventName CacheItemExpireAt |
|
| 161 | + * @param ExtendedCacheItemInterface $this |
|
| 162 | + * @param DateTimeInterface $expiration |
|
| 163 | + */ |
|
| 164 | + $this->eventManager->dispatch('CacheItemExpireAt', $this, $expiration); |
|
| 165 | + $this->expirationDate = $expiration; |
|
| 166 | + } else { |
|
| 167 | + throw new PhpfastcacheInvalidArgumentException('$expiration must be an object implementing the DateTimeInterface got: ' . \gettype($expiration)); |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + return $this; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * @param DateInterval|int $time |
|
| 175 | + * @return $this |
|
| 176 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 177 | + */ |
|
| 178 | + public function expiresAfter($time) |
|
| 179 | + { |
|
| 180 | + if (\is_numeric($time)) { |
|
| 181 | + if ($time <= 0) { |
|
| 182 | + /** |
|
| 183 | + * 5 years, however memcached or memory cached will gone when u restart it |
|
| 184 | + * just recommended for sqlite. files |
|
| 185 | + */ |
|
| 186 | + $time = 30 * 24 * 3600 * 5; |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * @eventName CacheItemExpireAt |
|
| 191 | + * @param ExtendedCacheItemInterface $this |
|
| 192 | + * @param DateTimeInterface $expiration |
|
| 193 | + */ |
|
| 194 | + $this->eventManager->dispatch('CacheItemExpireAfter', $this, $time); |
|
| 195 | + |
|
| 196 | + $this->expirationDate = (new DateTime())->add(new DateInterval(\sprintf('PT%dS', $time))); |
|
| 197 | + } else { |
|
| 198 | + if ($time instanceof DateInterval) { |
|
| 199 | + /** |
|
| 200 | + * @eventName CacheItemExpireAt |
|
| 201 | + * @param ExtendedCacheItemInterface $this |
|
| 202 | + * @param DateTimeInterface $expiration |
|
| 203 | + */ |
|
| 204 | + $this->eventManager->dispatch('CacheItemExpireAfter', $this, $time); |
|
| 205 | + |
|
| 206 | + $this->expirationDate = (new DateTime())->add($time); |
|
| 207 | + } else { |
|
| 208 | + throw new PhpfastcacheInvalidArgumentException(\sprintf('Invalid date format, got "%s"', \gettype($time))); |
|
| 209 | + } |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + return $this; |
|
| 213 | + } |
|
| 214 | 214 | } |
@@ -86,16 +86,14 @@ discard block |
||
| 86 | 86 | /** |
| 87 | 87 | * @return string |
| 88 | 88 | */ |
| 89 | - public function getKey() |
|
| 90 | - { |
|
| 89 | + public function getKey() { |
|
| 91 | 90 | return $this->key; |
| 92 | 91 | } |
| 93 | 92 | |
| 94 | 93 | /** |
| 95 | 94 | * @return mixed |
| 96 | 95 | */ |
| 97 | - public function get() |
|
| 98 | - { |
|
| 96 | + public function get() { |
|
| 99 | 97 | return $this->data; |
| 100 | 98 | } |
| 101 | 99 | |
@@ -103,8 +101,7 @@ discard block |
||
| 103 | 101 | * @param mixed $value |
| 104 | 102 | * @return $this |
| 105 | 103 | */ |
| 106 | - public function set($value) |
|
| 107 | - { |
|
| 104 | + public function set($value) { |
|
| 108 | 105 | /** |
| 109 | 106 | * The user set a value, |
| 110 | 107 | * therefore there is no need to |
@@ -163,7 +160,8 @@ discard block |
||
| 163 | 160 | */ |
| 164 | 161 | $this->eventManager->dispatch('CacheItemExpireAt', $this, $expiration); |
| 165 | 162 | $this->expirationDate = $expiration; |
| 166 | - } else { |
|
| 163 | + } |
|
| 164 | + else { |
|
| 167 | 165 | throw new PhpfastcacheInvalidArgumentException('$expiration must be an object implementing the DateTimeInterface got: ' . \gettype($expiration)); |
| 168 | 166 | } |
| 169 | 167 | |
@@ -175,8 +173,7 @@ discard block |
||
| 175 | 173 | * @return $this |
| 176 | 174 | * @throws PhpfastcacheInvalidArgumentException |
| 177 | 175 | */ |
| 178 | - public function expiresAfter($time) |
|
| 179 | - { |
|
| 176 | + public function expiresAfter($time) { |
|
| 180 | 177 | if (\is_numeric($time)) { |
| 181 | 178 | if ($time <= 0) { |
| 182 | 179 | /** |
@@ -194,7 +191,8 @@ discard block |
||
| 194 | 191 | $this->eventManager->dispatch('CacheItemExpireAfter', $this, $time); |
| 195 | 192 | |
| 196 | 193 | $this->expirationDate = (new DateTime())->add(new DateInterval(\sprintf('PT%dS', $time))); |
| 197 | - } else { |
|
| 194 | + } |
|
| 195 | + else { |
|
| 198 | 196 | if ($time instanceof DateInterval) { |
| 199 | 197 | /** |
| 200 | 198 | * @eventName CacheItemExpireAt |
@@ -204,7 +202,8 @@ discard block |
||
| 204 | 202 | $this->eventManager->dispatch('CacheItemExpireAfter', $this, $time); |
| 205 | 203 | |
| 206 | 204 | $this->expirationDate = (new DateTime())->add($time); |
| 207 | - } else { |
|
| 205 | + } |
|
| 206 | + else { |
|
| 208 | 207 | throw new PhpfastcacheInvalidArgumentException(\sprintf('Invalid date format, got "%s"', \gettype($time))); |
| 209 | 208 | } |
| 210 | 209 | } |
@@ -26,256 +26,256 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | interface TaggableCacheItemPoolInterface |
| 28 | 28 | { |
| 29 | - public const DRIVER_TAGS_KEY_PREFIX = '_TAG_'; |
|
| 29 | + public const DRIVER_TAGS_KEY_PREFIX = '_TAG_'; |
|
| 30 | 30 | |
| 31 | - public const DRIVER_TAGS_WRAPPER_INDEX = 'g'; |
|
| 31 | + public const DRIVER_TAGS_WRAPPER_INDEX = 'g'; |
|
| 32 | 32 | |
| 33 | - public const TAG_STRATEGY_ONE = 1; |
|
| 33 | + public const TAG_STRATEGY_ONE = 1; |
|
| 34 | 34 | |
| 35 | - public const TAG_STRATEGY_ALL = 2; |
|
| 35 | + public const TAG_STRATEGY_ALL = 2; |
|
| 36 | 36 | |
| 37 | - public const TAG_STRATEGY_ONLY = 4; |
|
| 37 | + public const TAG_STRATEGY_ONLY = 4; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Returns a traversable set of cache items by a tag name. |
|
| 41 | - * |
|
| 42 | - * @param string $tagName |
|
| 43 | - * An indexed array of keys of items to retrieve. |
|
| 44 | - * |
|
| 45 | - * @param int $strategy |
|
| 46 | - * |
|
| 47 | - * @return ExtendedCacheItemInterface[] |
|
| 48 | - * A traversable collection of Cache Items keyed by the cache keys of |
|
| 49 | - * each item. A Cache item will be returned for each key, even if that |
|
| 50 | - * key is not found. However, if no keys are specified then an empty |
|
| 51 | - * traversable MUST be returned instead. |
|
| 52 | - * @throws InvalidArgumentException |
|
| 53 | - * If any of the keys in $keys are not a legal value a phpfastcacheInvalidArgumentException |
|
| 54 | - * MUST be thrown. |
|
| 55 | - * |
|
| 56 | - */ |
|
| 57 | - public function getItemsByTag(string $tagName, int $strategy = self::TAG_STRATEGY_ONE): array; |
|
| 39 | + /** |
|
| 40 | + * Returns a traversable set of cache items by a tag name. |
|
| 41 | + * |
|
| 42 | + * @param string $tagName |
|
| 43 | + * An indexed array of keys of items to retrieve. |
|
| 44 | + * |
|
| 45 | + * @param int $strategy |
|
| 46 | + * |
|
| 47 | + * @return ExtendedCacheItemInterface[] |
|
| 48 | + * A traversable collection of Cache Items keyed by the cache keys of |
|
| 49 | + * each item. A Cache item will be returned for each key, even if that |
|
| 50 | + * key is not found. However, if no keys are specified then an empty |
|
| 51 | + * traversable MUST be returned instead. |
|
| 52 | + * @throws InvalidArgumentException |
|
| 53 | + * If any of the keys in $keys are not a legal value a phpfastcacheInvalidArgumentException |
|
| 54 | + * MUST be thrown. |
|
| 55 | + * |
|
| 56 | + */ |
|
| 57 | + public function getItemsByTag(string $tagName, int $strategy = self::TAG_STRATEGY_ONE): array; |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Returns a traversable set of cache items by one of multiple tag names. |
|
| 61 | - * |
|
| 62 | - * @param string[] $tagNames |
|
| 63 | - * An indexed array of keys of items to retrieve. |
|
| 64 | - * |
|
| 65 | - * @param int $strategy |
|
| 66 | - * |
|
| 67 | - * @return ExtendedCacheItemInterface[] |
|
| 68 | - * A traversable collection of Cache Items keyed by the cache keys of |
|
| 69 | - * each item. A Cache item will be returned for each key, even if that |
|
| 70 | - * key is not found. However, if no keys are specified then an empty |
|
| 71 | - * traversable MUST be returned instead. |
|
| 72 | - * @throws InvalidArgumentException |
|
| 73 | - * If any of the keys in $keys are not a legal value a phpfastcacheInvalidArgumentException |
|
| 74 | - * MUST be thrown. |
|
| 75 | - * |
|
| 76 | - */ |
|
| 77 | - public function getItemsByTags(array $tagNames, int $strategy = self::TAG_STRATEGY_ONE): array; |
|
| 59 | + /** |
|
| 60 | + * Returns a traversable set of cache items by one of multiple tag names. |
|
| 61 | + * |
|
| 62 | + * @param string[] $tagNames |
|
| 63 | + * An indexed array of keys of items to retrieve. |
|
| 64 | + * |
|
| 65 | + * @param int $strategy |
|
| 66 | + * |
|
| 67 | + * @return ExtendedCacheItemInterface[] |
|
| 68 | + * A traversable collection of Cache Items keyed by the cache keys of |
|
| 69 | + * each item. A Cache item will be returned for each key, even if that |
|
| 70 | + * key is not found. However, if no keys are specified then an empty |
|
| 71 | + * traversable MUST be returned instead. |
|
| 72 | + * @throws InvalidArgumentException |
|
| 73 | + * If any of the keys in $keys are not a legal value a phpfastcacheInvalidArgumentException |
|
| 74 | + * MUST be thrown. |
|
| 75 | + * |
|
| 76 | + */ |
|
| 77 | + public function getItemsByTags(array $tagNames, int $strategy = self::TAG_STRATEGY_ONE): array; |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Returns A json string that represents an array of items by tags-based. |
|
| 81 | - * |
|
| 82 | - * @param string[] $tagNames |
|
| 83 | - * An indexed array of keys of items to retrieve. |
|
| 84 | - * @param int $option \json_encode() options |
|
| 85 | - * @param int $depth \json_encode() depth |
|
| 86 | - * @param int $strategy |
|
| 87 | - * |
|
| 88 | - * @return string |
|
| 89 | - * @throws InvalidArgumentException |
|
| 90 | - * If any of the keys in $keys are not a legal value a phpfastcacheInvalidArgumentException |
|
| 91 | - * MUST be thrown. |
|
| 92 | - * |
|
| 93 | - */ |
|
| 94 | - public function getItemsByTagsAsJsonString(array $tagNames, int $option = 0, int $depth = 512, int $strategy = self::TAG_STRATEGY_ONE): string; |
|
| 79 | + /** |
|
| 80 | + * Returns A json string that represents an array of items by tags-based. |
|
| 81 | + * |
|
| 82 | + * @param string[] $tagNames |
|
| 83 | + * An indexed array of keys of items to retrieve. |
|
| 84 | + * @param int $option \json_encode() options |
|
| 85 | + * @param int $depth \json_encode() depth |
|
| 86 | + * @param int $strategy |
|
| 87 | + * |
|
| 88 | + * @return string |
|
| 89 | + * @throws InvalidArgumentException |
|
| 90 | + * If any of the keys in $keys are not a legal value a phpfastcacheInvalidArgumentException |
|
| 91 | + * MUST be thrown. |
|
| 92 | + * |
|
| 93 | + */ |
|
| 94 | + public function getItemsByTagsAsJsonString(array $tagNames, int $option = 0, int $depth = 512, int $strategy = self::TAG_STRATEGY_ONE): string; |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Removes the item from the pool by tag. |
|
| 98 | - * |
|
| 99 | - * @param string $tagName |
|
| 100 | - * The tag for which to delete |
|
| 101 | - * |
|
| 102 | - * @param int $strategy |
|
| 103 | - * |
|
| 104 | - * @return bool |
|
| 105 | - * True if the item was successfully removed. False if there was an error. |
|
| 106 | - * @throws InvalidArgumentException |
|
| 107 | - * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 108 | - * MUST be thrown. |
|
| 109 | - * |
|
| 110 | - */ |
|
| 111 | - public function deleteItemsByTag(string $tagName, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 96 | + /** |
|
| 97 | + * Removes the item from the pool by tag. |
|
| 98 | + * |
|
| 99 | + * @param string $tagName |
|
| 100 | + * The tag for which to delete |
|
| 101 | + * |
|
| 102 | + * @param int $strategy |
|
| 103 | + * |
|
| 104 | + * @return bool |
|
| 105 | + * True if the item was successfully removed. False if there was an error. |
|
| 106 | + * @throws InvalidArgumentException |
|
| 107 | + * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 108 | + * MUST be thrown. |
|
| 109 | + * |
|
| 110 | + */ |
|
| 111 | + public function deleteItemsByTag(string $tagName, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * Removes the item from the pool by one of multiple tag names. |
|
| 115 | - * |
|
| 116 | - * @param string[] $tagNames |
|
| 117 | - * The tag for which to delete |
|
| 118 | - * |
|
| 119 | - * @param int $strategy |
|
| 120 | - * |
|
| 121 | - * @return bool |
|
| 122 | - * True if the items were successfully removed. False if there was an error. |
|
| 123 | - * @throws InvalidArgumentException |
|
| 124 | - * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 125 | - * MUST be thrown. |
|
| 126 | - * |
|
| 127 | - */ |
|
| 128 | - public function deleteItemsByTags(array $tagNames, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 113 | + /** |
|
| 114 | + * Removes the item from the pool by one of multiple tag names. |
|
| 115 | + * |
|
| 116 | + * @param string[] $tagNames |
|
| 117 | + * The tag for which to delete |
|
| 118 | + * |
|
| 119 | + * @param int $strategy |
|
| 120 | + * |
|
| 121 | + * @return bool |
|
| 122 | + * True if the items were successfully removed. False if there was an error. |
|
| 123 | + * @throws InvalidArgumentException |
|
| 124 | + * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 125 | + * MUST be thrown. |
|
| 126 | + * |
|
| 127 | + */ |
|
| 128 | + public function deleteItemsByTags(array $tagNames, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 129 | 129 | |
| 130 | - /** |
|
| 131 | - * Increment the items from the pool by tag. |
|
| 132 | - * |
|
| 133 | - * @param string $tagName |
|
| 134 | - * The tag for which to increment |
|
| 135 | - * |
|
| 136 | - * @param int $step |
|
| 137 | - * |
|
| 138 | - * @param int $strategy |
|
| 139 | - * |
|
| 140 | - * @return bool |
|
| 141 | - * True if the item was successfully incremented. False if there was an error. |
|
| 142 | - * @throws InvalidArgumentException |
|
| 143 | - * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 144 | - * MUST be thrown. |
|
| 145 | - * |
|
| 146 | - */ |
|
| 147 | - public function incrementItemsByTag(string $tagName, int $step = 1, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 130 | + /** |
|
| 131 | + * Increment the items from the pool by tag. |
|
| 132 | + * |
|
| 133 | + * @param string $tagName |
|
| 134 | + * The tag for which to increment |
|
| 135 | + * |
|
| 136 | + * @param int $step |
|
| 137 | + * |
|
| 138 | + * @param int $strategy |
|
| 139 | + * |
|
| 140 | + * @return bool |
|
| 141 | + * True if the item was successfully incremented. False if there was an error. |
|
| 142 | + * @throws InvalidArgumentException |
|
| 143 | + * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 144 | + * MUST be thrown. |
|
| 145 | + * |
|
| 146 | + */ |
|
| 147 | + public function incrementItemsByTag(string $tagName, int $step = 1, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 148 | 148 | |
| 149 | - /** |
|
| 150 | - * Increment the items from the pool by one of multiple tag names. |
|
| 151 | - * |
|
| 152 | - * @param string[] $tagNames |
|
| 153 | - * The tag for which to increment |
|
| 154 | - * |
|
| 155 | - * @param int $step |
|
| 156 | - * |
|
| 157 | - * @param int $strategy |
|
| 158 | - * |
|
| 159 | - * @return bool |
|
| 160 | - * True if the items were successfully incremented. False if there was an error. |
|
| 161 | - * @throws InvalidArgumentException |
|
| 162 | - * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 163 | - * MUST be thrown. |
|
| 164 | - * |
|
| 165 | - */ |
|
| 166 | - public function incrementItemsByTags(array $tagNames, int $step = 1, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 149 | + /** |
|
| 150 | + * Increment the items from the pool by one of multiple tag names. |
|
| 151 | + * |
|
| 152 | + * @param string[] $tagNames |
|
| 153 | + * The tag for which to increment |
|
| 154 | + * |
|
| 155 | + * @param int $step |
|
| 156 | + * |
|
| 157 | + * @param int $strategy |
|
| 158 | + * |
|
| 159 | + * @return bool |
|
| 160 | + * True if the items were successfully incremented. False if there was an error. |
|
| 161 | + * @throws InvalidArgumentException |
|
| 162 | + * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 163 | + * MUST be thrown. |
|
| 164 | + * |
|
| 165 | + */ |
|
| 166 | + public function incrementItemsByTags(array $tagNames, int $step = 1, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 167 | 167 | |
| 168 | - /** |
|
| 169 | - * Decrement the items from the pool by tag. |
|
| 170 | - * |
|
| 171 | - * @param string $tagName |
|
| 172 | - * The tag for which to decrement |
|
| 173 | - * |
|
| 174 | - * @param int $step |
|
| 175 | - * |
|
| 176 | - * @param int $strategy |
|
| 177 | - * |
|
| 178 | - * @return bool |
|
| 179 | - * True if the item was successfully decremented. False if there was an error. |
|
| 180 | - * @throws InvalidArgumentException |
|
| 181 | - * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 182 | - * MUST be thrown. |
|
| 183 | - * |
|
| 184 | - */ |
|
| 185 | - public function decrementItemsByTag(string $tagName, int $step = 1, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 168 | + /** |
|
| 169 | + * Decrement the items from the pool by tag. |
|
| 170 | + * |
|
| 171 | + * @param string $tagName |
|
| 172 | + * The tag for which to decrement |
|
| 173 | + * |
|
| 174 | + * @param int $step |
|
| 175 | + * |
|
| 176 | + * @param int $strategy |
|
| 177 | + * |
|
| 178 | + * @return bool |
|
| 179 | + * True if the item was successfully decremented. False if there was an error. |
|
| 180 | + * @throws InvalidArgumentException |
|
| 181 | + * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 182 | + * MUST be thrown. |
|
| 183 | + * |
|
| 184 | + */ |
|
| 185 | + public function decrementItemsByTag(string $tagName, int $step = 1, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 186 | 186 | |
| 187 | - /** |
|
| 188 | - * Decrement the items from the pool by one of multiple tag names. |
|
| 189 | - * |
|
| 190 | - * @param string[] $tagNames |
|
| 191 | - * The tag for which to decrement |
|
| 192 | - * |
|
| 193 | - * @param int $step |
|
| 194 | - * |
|
| 195 | - * @param int $strategy |
|
| 196 | - * |
|
| 197 | - * @return bool |
|
| 198 | - * True if the item was successfully decremented. False if there was an error. |
|
| 199 | - * @throws InvalidArgumentException |
|
| 200 | - * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 201 | - * MUST be thrown. |
|
| 202 | - * |
|
| 203 | - */ |
|
| 204 | - public function decrementItemsByTags(array $tagNames, int $step = 1, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 187 | + /** |
|
| 188 | + * Decrement the items from the pool by one of multiple tag names. |
|
| 189 | + * |
|
| 190 | + * @param string[] $tagNames |
|
| 191 | + * The tag for which to decrement |
|
| 192 | + * |
|
| 193 | + * @param int $step |
|
| 194 | + * |
|
| 195 | + * @param int $strategy |
|
| 196 | + * |
|
| 197 | + * @return bool |
|
| 198 | + * True if the item was successfully decremented. False if there was an error. |
|
| 199 | + * @throws InvalidArgumentException |
|
| 200 | + * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 201 | + * MUST be thrown. |
|
| 202 | + * |
|
| 203 | + */ |
|
| 204 | + public function decrementItemsByTags(array $tagNames, int $step = 1, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 205 | 205 | |
| 206 | - /** |
|
| 207 | - * Decrement the items from the pool by tag. |
|
| 208 | - * |
|
| 209 | - * @param string $tagName |
|
| 210 | - * The tag for which to append |
|
| 211 | - * |
|
| 212 | - * @param array|string $data |
|
| 213 | - * |
|
| 214 | - * @param int $strategy |
|
| 215 | - * |
|
| 216 | - * @return bool |
|
| 217 | - * True if the item was successfully appended. False if there was an error. |
|
| 218 | - * @throws InvalidArgumentException |
|
| 219 | - * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 220 | - * MUST be thrown. |
|
| 221 | - * |
|
| 222 | - */ |
|
| 223 | - public function appendItemsByTag(string $tagName, $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 206 | + /** |
|
| 207 | + * Decrement the items from the pool by tag. |
|
| 208 | + * |
|
| 209 | + * @param string $tagName |
|
| 210 | + * The tag for which to append |
|
| 211 | + * |
|
| 212 | + * @param array|string $data |
|
| 213 | + * |
|
| 214 | + * @param int $strategy |
|
| 215 | + * |
|
| 216 | + * @return bool |
|
| 217 | + * True if the item was successfully appended. False if there was an error. |
|
| 218 | + * @throws InvalidArgumentException |
|
| 219 | + * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 220 | + * MUST be thrown. |
|
| 221 | + * |
|
| 222 | + */ |
|
| 223 | + public function appendItemsByTag(string $tagName, $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 224 | 224 | |
| 225 | - /** |
|
| 226 | - * Append the items from the pool by one of multiple tag names. |
|
| 227 | - * |
|
| 228 | - * @param string[] $tagNames |
|
| 229 | - * The tag for which to append |
|
| 230 | - * |
|
| 231 | - * @param array|string $data |
|
| 232 | - * |
|
| 233 | - * @param int $strategy |
|
| 234 | - * |
|
| 235 | - * @return bool |
|
| 236 | - * True if the items were successfully appended. False if there was an error. |
|
| 237 | - * @throws InvalidArgumentException |
|
| 238 | - * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 239 | - * MUST be thrown. |
|
| 240 | - * |
|
| 241 | - */ |
|
| 242 | - public function appendItemsByTags(array $tagNames, $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 225 | + /** |
|
| 226 | + * Append the items from the pool by one of multiple tag names. |
|
| 227 | + * |
|
| 228 | + * @param string[] $tagNames |
|
| 229 | + * The tag for which to append |
|
| 230 | + * |
|
| 231 | + * @param array|string $data |
|
| 232 | + * |
|
| 233 | + * @param int $strategy |
|
| 234 | + * |
|
| 235 | + * @return bool |
|
| 236 | + * True if the items were successfully appended. False if there was an error. |
|
| 237 | + * @throws InvalidArgumentException |
|
| 238 | + * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 239 | + * MUST be thrown. |
|
| 240 | + * |
|
| 241 | + */ |
|
| 242 | + public function appendItemsByTags(array $tagNames, $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 243 | 243 | |
| 244 | - /** |
|
| 245 | - * Prepend the items from the pool by tag. |
|
| 246 | - * |
|
| 247 | - * @param string $tagName |
|
| 248 | - * The tag for which to prepend |
|
| 249 | - * |
|
| 250 | - * @param array|string $data |
|
| 251 | - * |
|
| 252 | - * @param int $strategy |
|
| 253 | - * |
|
| 254 | - * @return bool |
|
| 255 | - * True if the item was successfully prepended. False if there was an error. |
|
| 256 | - * @throws InvalidArgumentException |
|
| 257 | - * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 258 | - * MUST be thrown. |
|
| 259 | - * |
|
| 260 | - */ |
|
| 261 | - public function prependItemsByTag(string $tagName, $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 244 | + /** |
|
| 245 | + * Prepend the items from the pool by tag. |
|
| 246 | + * |
|
| 247 | + * @param string $tagName |
|
| 248 | + * The tag for which to prepend |
|
| 249 | + * |
|
| 250 | + * @param array|string $data |
|
| 251 | + * |
|
| 252 | + * @param int $strategy |
|
| 253 | + * |
|
| 254 | + * @return bool |
|
| 255 | + * True if the item was successfully prepended. False if there was an error. |
|
| 256 | + * @throws InvalidArgumentException |
|
| 257 | + * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 258 | + * MUST be thrown. |
|
| 259 | + * |
|
| 260 | + */ |
|
| 261 | + public function prependItemsByTag(string $tagName, $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 262 | 262 | |
| 263 | - /** |
|
| 264 | - * Prepend the items from the pool by one of multiple tag names. |
|
| 265 | - * |
|
| 266 | - * @param string[] $tagNames |
|
| 267 | - * The tag for which to prepend |
|
| 268 | - * |
|
| 269 | - * @param array|string $data |
|
| 270 | - * |
|
| 271 | - * @param int $strategy |
|
| 272 | - * |
|
| 273 | - * @return bool |
|
| 274 | - * True if the item was successfully prepended. False if there was an error. |
|
| 275 | - * @throws InvalidArgumentException |
|
| 276 | - * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 277 | - * MUST be thrown. |
|
| 278 | - * |
|
| 279 | - */ |
|
| 280 | - public function prependItemsByTags(array $tagNames, $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 263 | + /** |
|
| 264 | + * Prepend the items from the pool by one of multiple tag names. |
|
| 265 | + * |
|
| 266 | + * @param string[] $tagNames |
|
| 267 | + * The tag for which to prepend |
|
| 268 | + * |
|
| 269 | + * @param array|string $data |
|
| 270 | + * |
|
| 271 | + * @param int $strategy |
|
| 272 | + * |
|
| 273 | + * @return bool |
|
| 274 | + * True if the item was successfully prepended. False if there was an error. |
|
| 275 | + * @throws InvalidArgumentException |
|
| 276 | + * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 277 | + * MUST be thrown. |
|
| 278 | + * |
|
| 279 | + */ |
|
| 280 | + public function prependItemsByTags(array $tagNames, $data, int $strategy = self::TAG_STRATEGY_ONE): bool; |
|
| 281 | 281 | } |
@@ -41,171 +41,171 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | interface ExtendedCacheItemPoolInterface extends CacheItemPoolInterface, EventManagerDispatcherInterface, ClassNamespaceResolverInterface, TaggableCacheItemPoolInterface |
| 43 | 43 | { |
| 44 | - public const DRIVER_CHECK_FAILURE = '%s is not installed or is misconfigured, cannot continue. |
|
| 44 | + public const DRIVER_CHECK_FAILURE = '%s is not installed or is misconfigured, cannot continue. |
|
| 45 | 45 | Also, please verify the suggested dependencies in composer because as of the V6, 3rd party libraries are no longer required.'; |
| 46 | 46 | |
| 47 | - public const DRIVER_CONNECT_FAILURE = '%s failed to connect with the following error message: "%s" line %d in %s'; |
|
| 48 | - |
|
| 49 | - public const DRIVER_KEY_WRAPPER_INDEX = 'k'; |
|
| 50 | - |
|
| 51 | - public const DRIVER_DATA_WRAPPER_INDEX = 'd'; |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Expiration date Index |
|
| 55 | - */ |
|
| 56 | - public const DRIVER_EDATE_WRAPPER_INDEX = 'e'; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Creation date Index |
|
| 60 | - */ |
|
| 61 | - public const DRIVER_CDATE_WRAPPER_INDEX = 'c'; |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Modification date Index |
|
| 65 | - */ |
|
| 66 | - public const DRIVER_MDATE_WRAPPER_INDEX = 'm'; |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * Return the config class name |
|
| 70 | - * @return string |
|
| 71 | - */ |
|
| 72 | - public static function getConfigClass(): string; |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * @return ConfigurationOption |
|
| 76 | - */ |
|
| 77 | - public function getConfig(): ConfigurationOption; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @return ConfigurationOption |
|
| 81 | - */ |
|
| 82 | - public function getDefaultConfig(): ConfigurationOption; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * @return string |
|
| 86 | - */ |
|
| 87 | - public function getDriverName(): string; |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * @return mixed |
|
| 91 | - */ |
|
| 92 | - public function getInstanceId(): string; |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * [phpFastCache phpDoc Override] |
|
| 96 | - * Returns a Cache Item representing the specified key. |
|
| 97 | - * |
|
| 98 | - * This method must always return a CacheItemInterface object, even in case of |
|
| 99 | - * a cache miss. It MUST NOT return null. |
|
| 100 | - * |
|
| 101 | - * @param string $key |
|
| 102 | - * The key for which to return the corresponding Cache Item. |
|
| 103 | - * |
|
| 104 | - * @return ExtendedCacheItemInterface |
|
| 105 | - * The corresponding Cache Item. |
|
| 106 | - * @throws PhpfastcacheInvalidArgumentException |
|
| 107 | - * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 108 | - * MUST be thrown. |
|
| 109 | - * |
|
| 110 | - */ |
|
| 111 | - public function getItem($key); |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * [phpFastCache phpDoc Override] |
|
| 115 | - * Returns a traversable set of cache items. |
|
| 116 | - * |
|
| 117 | - * @param array $keys |
|
| 118 | - * An indexed array of keys of items to retrieve. |
|
| 119 | - * |
|
| 120 | - * @return ExtendedCacheItemInterface[] |
|
| 121 | - * A traversable collection of Cache Items keyed by the cache keys of |
|
| 122 | - * each item. A Cache item will be returned for each key, even if that |
|
| 123 | - * key is not found. However, if no keys are specified then an empty |
|
| 124 | - * traversable MUST be returned instead. |
|
| 125 | - * @throws InvalidArgumentException |
|
| 126 | - * If any of the keys in $keys are not a legal value a phpfastcacheInvalidArgumentException |
|
| 127 | - * MUST be thrown. |
|
| 128 | - * |
|
| 129 | - */ |
|
| 130 | - public function getItems(array $keys = []); |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * Returns A json string that represents an array of items. |
|
| 134 | - * |
|
| 135 | - * @param array $keys |
|
| 136 | - * An indexed array of keys of items to retrieve. |
|
| 137 | - * @param int $option \json_encode() options |
|
| 138 | - * @param int $depth \json_encode() depth |
|
| 139 | - * |
|
| 140 | - * @return string |
|
| 141 | - * @throws InvalidArgumentException |
|
| 142 | - * If any of the keys in $keys are not a legal value a phpfastcacheInvalidArgumentException |
|
| 143 | - * MUST be thrown. |
|
| 144 | - * |
|
| 145 | - */ |
|
| 146 | - public function getItemsAsJsonString(array $keys = [], int $option = 0, int $depth = 512): string; |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * @param CacheItemInterface $item |
|
| 150 | - * @return mixed |
|
| 151 | - */ |
|
| 152 | - public function setItem(CacheItemInterface $item); |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * @return DriverStatistic |
|
| 156 | - */ |
|
| 157 | - public function getStats(): DriverStatistic; |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * Get a quick help guide |
|
| 161 | - * about the current driver |
|
| 162 | - * |
|
| 163 | - * @return string |
|
| 164 | - */ |
|
| 165 | - public function getHelp(): string; |
|
| 166 | - |
|
| 167 | - /** |
|
| 168 | - * @param CacheItemInterface $item |
|
| 169 | - * @return void |
|
| 170 | - */ |
|
| 171 | - public function detachItem(CacheItemInterface $item); |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * @return void |
|
| 175 | - */ |
|
| 176 | - public function detachAllItems(); |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * @param CacheItemInterface $item |
|
| 180 | - * @return void |
|
| 181 | - * @throws PhpfastcacheLogicException |
|
| 182 | - */ |
|
| 183 | - public function attachItem(CacheItemInterface $item); |
|
| 184 | - |
|
| 185 | - /** |
|
| 186 | - * Returns true if the item exists, is attached and the Spl Hash matches |
|
| 187 | - * Returns false if the item exists, is attached and the Spl Hash mismatches |
|
| 188 | - * Returns null if the item does not exists |
|
| 189 | - * |
|
| 190 | - * @param CacheItemInterface $item |
|
| 191 | - * @return bool|null |
|
| 192 | - * @throws PhpfastcacheLogicException |
|
| 193 | - */ |
|
| 194 | - public function isAttached(CacheItemInterface $item); |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * Save multiple items, possible uses: |
|
| 198 | - * saveMultiple([$item1, $item2, $item3]); |
|
| 199 | - * saveMultiple($item1, $item2, $item3); |
|
| 200 | - * |
|
| 201 | - * @param ExtendedCacheItemInterface[] $items |
|
| 202 | - * @return bool |
|
| 203 | - */ |
|
| 204 | - public function saveMultiple(...$items): bool; |
|
| 205 | - |
|
| 206 | - |
|
| 207 | - /** |
|
| 208 | - * @return DriverIO |
|
| 209 | - */ |
|
| 210 | - public function getIO(): DriverIO; |
|
| 47 | + public const DRIVER_CONNECT_FAILURE = '%s failed to connect with the following error message: "%s" line %d in %s'; |
|
| 48 | + |
|
| 49 | + public const DRIVER_KEY_WRAPPER_INDEX = 'k'; |
|
| 50 | + |
|
| 51 | + public const DRIVER_DATA_WRAPPER_INDEX = 'd'; |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Expiration date Index |
|
| 55 | + */ |
|
| 56 | + public const DRIVER_EDATE_WRAPPER_INDEX = 'e'; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Creation date Index |
|
| 60 | + */ |
|
| 61 | + public const DRIVER_CDATE_WRAPPER_INDEX = 'c'; |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Modification date Index |
|
| 65 | + */ |
|
| 66 | + public const DRIVER_MDATE_WRAPPER_INDEX = 'm'; |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * Return the config class name |
|
| 70 | + * @return string |
|
| 71 | + */ |
|
| 72 | + public static function getConfigClass(): string; |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * @return ConfigurationOption |
|
| 76 | + */ |
|
| 77 | + public function getConfig(): ConfigurationOption; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @return ConfigurationOption |
|
| 81 | + */ |
|
| 82 | + public function getDefaultConfig(): ConfigurationOption; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @return string |
|
| 86 | + */ |
|
| 87 | + public function getDriverName(): string; |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @return mixed |
|
| 91 | + */ |
|
| 92 | + public function getInstanceId(): string; |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * [phpFastCache phpDoc Override] |
|
| 96 | + * Returns a Cache Item representing the specified key. |
|
| 97 | + * |
|
| 98 | + * This method must always return a CacheItemInterface object, even in case of |
|
| 99 | + * a cache miss. It MUST NOT return null. |
|
| 100 | + * |
|
| 101 | + * @param string $key |
|
| 102 | + * The key for which to return the corresponding Cache Item. |
|
| 103 | + * |
|
| 104 | + * @return ExtendedCacheItemInterface |
|
| 105 | + * The corresponding Cache Item. |
|
| 106 | + * @throws PhpfastcacheInvalidArgumentException |
|
| 107 | + * If the $key string is not a legal value a phpfastcacheInvalidArgumentException |
|
| 108 | + * MUST be thrown. |
|
| 109 | + * |
|
| 110 | + */ |
|
| 111 | + public function getItem($key); |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * [phpFastCache phpDoc Override] |
|
| 115 | + * Returns a traversable set of cache items. |
|
| 116 | + * |
|
| 117 | + * @param array $keys |
|
| 118 | + * An indexed array of keys of items to retrieve. |
|
| 119 | + * |
|
| 120 | + * @return ExtendedCacheItemInterface[] |
|
| 121 | + * A traversable collection of Cache Items keyed by the cache keys of |
|
| 122 | + * each item. A Cache item will be returned for each key, even if that |
|
| 123 | + * key is not found. However, if no keys are specified then an empty |
|
| 124 | + * traversable MUST be returned instead. |
|
| 125 | + * @throws InvalidArgumentException |
|
| 126 | + * If any of the keys in $keys are not a legal value a phpfastcacheInvalidArgumentException |
|
| 127 | + * MUST be thrown. |
|
| 128 | + * |
|
| 129 | + */ |
|
| 130 | + public function getItems(array $keys = []); |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * Returns A json string that represents an array of items. |
|
| 134 | + * |
|
| 135 | + * @param array $keys |
|
| 136 | + * An indexed array of keys of items to retrieve. |
|
| 137 | + * @param int $option \json_encode() options |
|
| 138 | + * @param int $depth \json_encode() depth |
|
| 139 | + * |
|
| 140 | + * @return string |
|
| 141 | + * @throws InvalidArgumentException |
|
| 142 | + * If any of the keys in $keys are not a legal value a phpfastcacheInvalidArgumentException |
|
| 143 | + * MUST be thrown. |
|
| 144 | + * |
|
| 145 | + */ |
|
| 146 | + public function getItemsAsJsonString(array $keys = [], int $option = 0, int $depth = 512): string; |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * @param CacheItemInterface $item |
|
| 150 | + * @return mixed |
|
| 151 | + */ |
|
| 152 | + public function setItem(CacheItemInterface $item); |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * @return DriverStatistic |
|
| 156 | + */ |
|
| 157 | + public function getStats(): DriverStatistic; |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * Get a quick help guide |
|
| 161 | + * about the current driver |
|
| 162 | + * |
|
| 163 | + * @return string |
|
| 164 | + */ |
|
| 165 | + public function getHelp(): string; |
|
| 166 | + |
|
| 167 | + /** |
|
| 168 | + * @param CacheItemInterface $item |
|
| 169 | + * @return void |
|
| 170 | + */ |
|
| 171 | + public function detachItem(CacheItemInterface $item); |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * @return void |
|
| 175 | + */ |
|
| 176 | + public function detachAllItems(); |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * @param CacheItemInterface $item |
|
| 180 | + * @return void |
|
| 181 | + * @throws PhpfastcacheLogicException |
|
| 182 | + */ |
|
| 183 | + public function attachItem(CacheItemInterface $item); |
|
| 184 | + |
|
| 185 | + /** |
|
| 186 | + * Returns true if the item exists, is attached and the Spl Hash matches |
|
| 187 | + * Returns false if the item exists, is attached and the Spl Hash mismatches |
|
| 188 | + * Returns null if the item does not exists |
|
| 189 | + * |
|
| 190 | + * @param CacheItemInterface $item |
|
| 191 | + * @return bool|null |
|
| 192 | + * @throws PhpfastcacheLogicException |
|
| 193 | + */ |
|
| 194 | + public function isAttached(CacheItemInterface $item); |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * Save multiple items, possible uses: |
|
| 198 | + * saveMultiple([$item1, $item2, $item3]); |
|
| 199 | + * saveMultiple($item1, $item2, $item3); |
|
| 200 | + * |
|
| 201 | + * @param ExtendedCacheItemInterface[] $items |
|
| 202 | + * @return bool |
|
| 203 | + */ |
|
| 204 | + public function saveMultiple(...$items): bool; |
|
| 205 | + |
|
| 206 | + |
|
| 207 | + /** |
|
| 208 | + * @return DriverIO |
|
| 209 | + */ |
|
| 210 | + public function getIO(): DriverIO; |
|
| 211 | 211 | } |
@@ -24,41 +24,41 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | trait AbstractDriverPoolTrait |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * @return bool |
|
| 29 | - */ |
|
| 30 | - abstract protected function driverCheck(): bool; |
|
| 27 | + /** |
|
| 28 | + * @return bool |
|
| 29 | + */ |
|
| 30 | + abstract protected function driverCheck(): bool; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @return bool |
|
| 34 | - */ |
|
| 35 | - abstract protected function driverConnect(): bool; |
|
| 32 | + /** |
|
| 33 | + * @return bool |
|
| 34 | + */ |
|
| 35 | + abstract protected function driverConnect(): bool; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @param CacheItemInterface $item |
|
| 39 | - * @return null|array [ |
|
| 40 | - * 'd' => 'THE ITEM DATA' |
|
| 41 | - * 't' => 'THE ITEM DATE EXPIRATION' |
|
| 42 | - * 'g' => 'THE ITEM TAGS' |
|
| 43 | - * ] |
|
| 44 | - * |
|
| 45 | - */ |
|
| 46 | - abstract protected function driverRead(CacheItemInterface $item); |
|
| 37 | + /** |
|
| 38 | + * @param CacheItemInterface $item |
|
| 39 | + * @return null|array [ |
|
| 40 | + * 'd' => 'THE ITEM DATA' |
|
| 41 | + * 't' => 'THE ITEM DATE EXPIRATION' |
|
| 42 | + * 'g' => 'THE ITEM TAGS' |
|
| 43 | + * ] |
|
| 44 | + * |
|
| 45 | + */ |
|
| 46 | + abstract protected function driverRead(CacheItemInterface $item); |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @param CacheItemInterface $item |
|
| 50 | - * @return bool |
|
| 51 | - */ |
|
| 52 | - abstract protected function driverWrite(CacheItemInterface $item): bool; |
|
| 48 | + /** |
|
| 49 | + * @param CacheItemInterface $item |
|
| 50 | + * @return bool |
|
| 51 | + */ |
|
| 52 | + abstract protected function driverWrite(CacheItemInterface $item): bool; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @param CacheItemInterface $item |
|
| 56 | - * @return bool |
|
| 57 | - */ |
|
| 58 | - abstract protected function driverDelete(CacheItemInterface $item): bool; |
|
| 54 | + /** |
|
| 55 | + * @param CacheItemInterface $item |
|
| 56 | + * @return bool |
|
| 57 | + */ |
|
| 58 | + abstract protected function driverDelete(CacheItemInterface $item): bool; |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @return bool |
|
| 62 | - */ |
|
| 63 | - abstract protected function driverClear(): bool; |
|
| 60 | + /** |
|
| 61 | + * @return bool |
|
| 62 | + */ |
|
| 63 | + abstract protected function driverClear(): bool; |
|
| 64 | 64 | } |
| 65 | 65 | \ No newline at end of file |