diff options
Diffstat (limited to 'vendor/symfony/cache')
66 files changed, 15234 insertions, 0 deletions
diff --git a/vendor/symfony/cache/Adapter/AbstractAdapter.php b/vendor/symfony/cache/Adapter/AbstractAdapter.php new file mode 100644 index 0000000..5d6336e --- /dev/null +++ b/vendor/symfony/cache/Adapter/AbstractAdapter.php | |||
@@ -0,0 +1,191 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Psr\Log\LoggerAwareInterface; | ||
15 | use Psr\Log\LoggerInterface; | ||
16 | use Symfony\Component\Cache\CacheItem; | ||
17 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
18 | use Symfony\Component\Cache\ResettableInterface; | ||
19 | use Symfony\Component\Cache\Traits\AbstractAdapterTrait; | ||
20 | use Symfony\Component\Cache\Traits\ContractsTrait; | ||
21 | use Symfony\Contracts\Cache\CacheInterface; | ||
22 | |||
23 | /** | ||
24 | * @author Nicolas Grekas <p@tchwork.com> | ||
25 | */ | ||
26 | abstract class AbstractAdapter implements AdapterInterface, CacheInterface, LoggerAwareInterface, ResettableInterface | ||
27 | { | ||
28 | use AbstractAdapterTrait; | ||
29 | use ContractsTrait; | ||
30 | |||
31 | /** | ||
32 | * @internal | ||
33 | */ | ||
34 | protected const NS_SEPARATOR = ':'; | ||
35 | |||
36 | private static bool $apcuSupported; | ||
37 | |||
38 | protected function __construct(string $namespace = '', int $defaultLifetime = 0) | ||
39 | { | ||
40 | $this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).static::NS_SEPARATOR; | ||
41 | $this->defaultLifetime = $defaultLifetime; | ||
42 | if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) { | ||
43 | throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace)); | ||
44 | } | ||
45 | self::$createCacheItem ??= \Closure::bind( | ||
46 | static function ($key, $value, $isHit) { | ||
47 | $item = new CacheItem(); | ||
48 | $item->key = $key; | ||
49 | $item->value = $value; | ||
50 | $item->isHit = $isHit; | ||
51 | $item->unpack(); | ||
52 | |||
53 | return $item; | ||
54 | }, | ||
55 | null, | ||
56 | CacheItem::class | ||
57 | ); | ||
58 | self::$mergeByLifetime ??= \Closure::bind( | ||
59 | static function ($deferred, $namespace, &$expiredIds, $getId, $defaultLifetime) { | ||
60 | $byLifetime = []; | ||
61 | $now = microtime(true); | ||
62 | $expiredIds = []; | ||
63 | |||
64 | foreach ($deferred as $key => $item) { | ||
65 | $key = (string) $key; | ||
66 | if (null === $item->expiry) { | ||
67 | $ttl = 0 < $defaultLifetime ? $defaultLifetime : 0; | ||
68 | } elseif (!$item->expiry) { | ||
69 | $ttl = 0; | ||
70 | } elseif (0 >= $ttl = (int) (0.1 + $item->expiry - $now)) { | ||
71 | $expiredIds[] = $getId($key); | ||
72 | continue; | ||
73 | } | ||
74 | $byLifetime[$ttl][$getId($key)] = $item->pack(); | ||
75 | } | ||
76 | |||
77 | return $byLifetime; | ||
78 | }, | ||
79 | null, | ||
80 | CacheItem::class | ||
81 | ); | ||
82 | } | ||
83 | |||
84 | /** | ||
85 | * Returns the best possible adapter that your runtime supports. | ||
86 | * | ||
87 | * Using ApcuAdapter makes system caches compatible with read-only filesystems. | ||
88 | */ | ||
89 | public static function createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, ?LoggerInterface $logger = null): AdapterInterface | ||
90 | { | ||
91 | $opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true); | ||
92 | if (null !== $logger) { | ||
93 | $opcache->setLogger($logger); | ||
94 | } | ||
95 | |||
96 | if (!self::$apcuSupported ??= ApcuAdapter::isSupported()) { | ||
97 | return $opcache; | ||
98 | } | ||
99 | |||
100 | if ('cli' === \PHP_SAPI && !filter_var(\ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOL)) { | ||
101 | return $opcache; | ||
102 | } | ||
103 | |||
104 | $apcu = new ApcuAdapter($namespace, intdiv($defaultLifetime, 5), $version); | ||
105 | if (null !== $logger) { | ||
106 | $apcu->setLogger($logger); | ||
107 | } | ||
108 | |||
109 | return new ChainAdapter([$apcu, $opcache]); | ||
110 | } | ||
111 | |||
112 | public static function createConnection(#[\SensitiveParameter] string $dsn, array $options = []): mixed | ||
113 | { | ||
114 | if (str_starts_with($dsn, 'redis:') || str_starts_with($dsn, 'rediss:')) { | ||
115 | return RedisAdapter::createConnection($dsn, $options); | ||
116 | } | ||
117 | if (str_starts_with($dsn, 'memcached:')) { | ||
118 | return MemcachedAdapter::createConnection($dsn, $options); | ||
119 | } | ||
120 | if (str_starts_with($dsn, 'couchbase:')) { | ||
121 | if (class_exists('CouchbaseBucket') && CouchbaseBucketAdapter::isSupported()) { | ||
122 | return CouchbaseBucketAdapter::createConnection($dsn, $options); | ||
123 | } | ||
124 | |||
125 | return CouchbaseCollectionAdapter::createConnection($dsn, $options); | ||
126 | } | ||
127 | if (preg_match('/^(mysql|oci|pgsql|sqlsrv|sqlite):/', $dsn)) { | ||
128 | return PdoAdapter::createConnection($dsn, $options); | ||
129 | } | ||
130 | |||
131 | throw new InvalidArgumentException('Unsupported DSN: it does not start with "redis[s]:", "memcached:", "couchbase:", "mysql:", "oci:", "pgsql:", "sqlsrv:" nor "sqlite:".'); | ||
132 | } | ||
133 | |||
134 | public function commit(): bool | ||
135 | { | ||
136 | $ok = true; | ||
137 | $byLifetime = (self::$mergeByLifetime)($this->deferred, $this->namespace, $expiredIds, $this->getId(...), $this->defaultLifetime); | ||
138 | $retry = $this->deferred = []; | ||
139 | |||
140 | if ($expiredIds) { | ||
141 | try { | ||
142 | $this->doDelete($expiredIds); | ||
143 | } catch (\Exception $e) { | ||
144 | $ok = false; | ||
145 | CacheItem::log($this->logger, 'Failed to delete expired items: '.$e->getMessage(), ['exception' => $e, 'cache-adapter' => get_debug_type($this)]); | ||
146 | } | ||
147 | } | ||
148 | foreach ($byLifetime as $lifetime => $values) { | ||
149 | try { | ||
150 | $e = $this->doSave($values, $lifetime); | ||
151 | } catch (\Exception $e) { | ||
152 | } | ||
153 | if (true === $e || [] === $e) { | ||
154 | continue; | ||
155 | } | ||
156 | if (\is_array($e) || 1 === \count($values)) { | ||
157 | foreach (\is_array($e) ? $e : array_keys($values) as $id) { | ||
158 | $ok = false; | ||
159 | $v = $values[$id]; | ||
160 | $type = get_debug_type($v); | ||
161 | $message = sprintf('Failed to save key "{key}" of type %s%s', $type, $e instanceof \Exception ? ': '.$e->getMessage() : '.'); | ||
162 | CacheItem::log($this->logger, $message, ['key' => substr($id, \strlen($this->namespace)), 'exception' => $e instanceof \Exception ? $e : null, 'cache-adapter' => get_debug_type($this)]); | ||
163 | } | ||
164 | } else { | ||
165 | foreach ($values as $id => $v) { | ||
166 | $retry[$lifetime][] = $id; | ||
167 | } | ||
168 | } | ||
169 | } | ||
170 | |||
171 | // When bulk-save failed, retry each item individually | ||
172 | foreach ($retry as $lifetime => $ids) { | ||
173 | foreach ($ids as $id) { | ||
174 | try { | ||
175 | $v = $byLifetime[$lifetime][$id]; | ||
176 | $e = $this->doSave([$id => $v], $lifetime); | ||
177 | } catch (\Exception $e) { | ||
178 | } | ||
179 | if (true === $e || [] === $e) { | ||
180 | continue; | ||
181 | } | ||
182 | $ok = false; | ||
183 | $type = get_debug_type($v); | ||
184 | $message = sprintf('Failed to save key "{key}" of type %s%s', $type, $e instanceof \Exception ? ': '.$e->getMessage() : '.'); | ||
185 | CacheItem::log($this->logger, $message, ['key' => substr($id, \strlen($this->namespace)), 'exception' => $e instanceof \Exception ? $e : null, 'cache-adapter' => get_debug_type($this)]); | ||
186 | } | ||
187 | } | ||
188 | |||
189 | return $ok; | ||
190 | } | ||
191 | } | ||
diff --git a/vendor/symfony/cache/Adapter/AbstractTagAwareAdapter.php b/vendor/symfony/cache/Adapter/AbstractTagAwareAdapter.php new file mode 100644 index 0000000..ef62b4f --- /dev/null +++ b/vendor/symfony/cache/Adapter/AbstractTagAwareAdapter.php | |||
@@ -0,0 +1,320 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Psr\Log\LoggerAwareInterface; | ||
15 | use Symfony\Component\Cache\CacheItem; | ||
16 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
17 | use Symfony\Component\Cache\ResettableInterface; | ||
18 | use Symfony\Component\Cache\Traits\AbstractAdapterTrait; | ||
19 | use Symfony\Component\Cache\Traits\ContractsTrait; | ||
20 | use Symfony\Contracts\Cache\TagAwareCacheInterface; | ||
21 | |||
22 | /** | ||
23 | * Abstract for native TagAware adapters. | ||
24 | * | ||
25 | * To keep info on tags, the tags are both serialized as part of cache value and provided as tag ids | ||
26 | * to Adapters on operations when needed for storage to doSave(), doDelete() & doInvalidate(). | ||
27 | * | ||
28 | * @author Nicolas Grekas <p@tchwork.com> | ||
29 | * @author André Rømcke <andre.romcke+symfony@gmail.com> | ||
30 | * | ||
31 | * @internal | ||
32 | */ | ||
33 | abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterface, LoggerAwareInterface, ResettableInterface | ||
34 | { | ||
35 | use AbstractAdapterTrait; | ||
36 | use ContractsTrait; | ||
37 | |||
38 | private const TAGS_PREFIX = "\1tags\1"; | ||
39 | |||
40 | protected function __construct(string $namespace = '', int $defaultLifetime = 0) | ||
41 | { | ||
42 | $this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).':'; | ||
43 | $this->defaultLifetime = $defaultLifetime; | ||
44 | if (null !== $this->maxIdLength && \strlen($namespace) > $this->maxIdLength - 24) { | ||
45 | throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s").', $this->maxIdLength - 24, \strlen($namespace), $namespace)); | ||
46 | } | ||
47 | self::$createCacheItem ??= \Closure::bind( | ||
48 | static function ($key, $value, $isHit) { | ||
49 | $item = new CacheItem(); | ||
50 | $item->key = $key; | ||
51 | $item->isTaggable = true; | ||
52 | // If structure does not match what we expect return item as is (no value and not a hit) | ||
53 | if (!\is_array($value) || !\array_key_exists('value', $value)) { | ||
54 | return $item; | ||
55 | } | ||
56 | $item->isHit = $isHit; | ||
57 | // Extract value, tags and meta data from the cache value | ||
58 | $item->value = $value['value']; | ||
59 | $item->metadata[CacheItem::METADATA_TAGS] = isset($value['tags']) ? array_combine($value['tags'], $value['tags']) : []; | ||
60 | if (isset($value['meta'])) { | ||
61 | // For compactness these values are packed, & expiry is offset to reduce size | ||
62 | $v = unpack('Ve/Nc', $value['meta']); | ||
63 | $item->metadata[CacheItem::METADATA_EXPIRY] = $v['e'] + CacheItem::METADATA_EXPIRY_OFFSET; | ||
64 | $item->metadata[CacheItem::METADATA_CTIME] = $v['c']; | ||
65 | } | ||
66 | |||
67 | return $item; | ||
68 | }, | ||
69 | null, | ||
70 | CacheItem::class | ||
71 | ); | ||
72 | self::$mergeByLifetime ??= \Closure::bind( | ||
73 | static function ($deferred, &$expiredIds, $getId, $tagPrefix, $defaultLifetime) { | ||
74 | $byLifetime = []; | ||
75 | $now = microtime(true); | ||
76 | $expiredIds = []; | ||
77 | |||
78 | foreach ($deferred as $key => $item) { | ||
79 | $key = (string) $key; | ||
80 | if (null === $item->expiry) { | ||
81 | $ttl = 0 < $defaultLifetime ? $defaultLifetime : 0; | ||
82 | } elseif (!$item->expiry) { | ||
83 | $ttl = 0; | ||
84 | } elseif (0 >= $ttl = (int) (0.1 + $item->expiry - $now)) { | ||
85 | $expiredIds[] = $getId($key); | ||
86 | continue; | ||
87 | } | ||
88 | // Store Value and Tags on the cache value | ||
89 | if (isset(($metadata = $item->newMetadata)[CacheItem::METADATA_TAGS])) { | ||
90 | $value = ['value' => $item->value, 'tags' => $metadata[CacheItem::METADATA_TAGS]]; | ||
91 | unset($metadata[CacheItem::METADATA_TAGS]); | ||
92 | } else { | ||
93 | $value = ['value' => $item->value, 'tags' => []]; | ||
94 | } | ||
95 | |||
96 | if ($metadata) { | ||
97 | // For compactness, expiry and creation duration are packed, using magic numbers as separators | ||
98 | $value['meta'] = pack('VN', (int) (0.1 + $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET), $metadata[CacheItem::METADATA_CTIME]); | ||
99 | } | ||
100 | |||
101 | // Extract tag changes, these should be removed from values in doSave() | ||
102 | $value['tag-operations'] = ['add' => [], 'remove' => []]; | ||
103 | $oldTags = $item->metadata[CacheItem::METADATA_TAGS] ?? []; | ||
104 | foreach (array_diff_key($value['tags'], $oldTags) as $addedTag) { | ||
105 | $value['tag-operations']['add'][] = $getId($tagPrefix.$addedTag); | ||
106 | } | ||
107 | foreach (array_diff_key($oldTags, $value['tags']) as $removedTag) { | ||
108 | $value['tag-operations']['remove'][] = $getId($tagPrefix.$removedTag); | ||
109 | } | ||
110 | $value['tags'] = array_keys($value['tags']); | ||
111 | |||
112 | $byLifetime[$ttl][$getId($key)] = $value; | ||
113 | $item->metadata = $item->newMetadata; | ||
114 | } | ||
115 | |||
116 | return $byLifetime; | ||
117 | }, | ||
118 | null, | ||
119 | CacheItem::class | ||
120 | ); | ||
121 | } | ||
122 | |||
123 | /** | ||
124 | * Persists several cache items immediately. | ||
125 | * | ||
126 | * @param array $values The values to cache, indexed by their cache identifier | ||
127 | * @param int $lifetime The lifetime of the cached values, 0 for persisting until manual cleaning | ||
128 | * @param array[] $addTagData Hash where key is tag id, and array value is list of cache id's to add to tag | ||
129 | * @param array[] $removeTagData Hash where key is tag id, and array value is list of cache id's to remove to tag | ||
130 | * | ||
131 | * @return array The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ||
132 | */ | ||
133 | abstract protected function doSave(array $values, int $lifetime, array $addTagData = [], array $removeTagData = []): array; | ||
134 | |||
135 | /** | ||
136 | * Removes multiple items from the pool and their corresponding tags. | ||
137 | * | ||
138 | * @param array $ids An array of identifiers that should be removed from the pool | ||
139 | */ | ||
140 | abstract protected function doDelete(array $ids): bool; | ||
141 | |||
142 | /** | ||
143 | * Removes relations between tags and deleted items. | ||
144 | * | ||
145 | * @param array $tagData Array of tag => key identifiers that should be removed from the pool | ||
146 | */ | ||
147 | abstract protected function doDeleteTagRelations(array $tagData): bool; | ||
148 | |||
149 | /** | ||
150 | * Invalidates cached items using tags. | ||
151 | * | ||
152 | * @param string[] $tagIds An array of tags to invalidate, key is tag and value is tag id | ||
153 | */ | ||
154 | abstract protected function doInvalidate(array $tagIds): bool; | ||
155 | |||
156 | /** | ||
157 | * Delete items and yields the tags they were bound to. | ||
158 | */ | ||
159 | protected function doDeleteYieldTags(array $ids): iterable | ||
160 | { | ||
161 | foreach ($this->doFetch($ids) as $id => $value) { | ||
162 | yield $id => \is_array($value) && \is_array($value['tags'] ?? null) ? $value['tags'] : []; | ||
163 | } | ||
164 | |||
165 | $this->doDelete($ids); | ||
166 | } | ||
167 | |||
168 | public function commit(): bool | ||
169 | { | ||
170 | $ok = true; | ||
171 | $byLifetime = (self::$mergeByLifetime)($this->deferred, $expiredIds, $this->getId(...), self::TAGS_PREFIX, $this->defaultLifetime); | ||
172 | $retry = $this->deferred = []; | ||
173 | |||
174 | if ($expiredIds) { | ||
175 | // Tags are not cleaned up in this case, however that is done on invalidateTags(). | ||
176 | try { | ||
177 | $this->doDelete($expiredIds); | ||
178 | } catch (\Exception $e) { | ||
179 | $ok = false; | ||
180 | CacheItem::log($this->logger, 'Failed to delete expired items: '.$e->getMessage(), ['exception' => $e, 'cache-adapter' => get_debug_type($this)]); | ||
181 | } | ||
182 | } | ||
183 | foreach ($byLifetime as $lifetime => $values) { | ||
184 | try { | ||
185 | $values = $this->extractTagData($values, $addTagData, $removeTagData); | ||
186 | $e = $this->doSave($values, $lifetime, $addTagData, $removeTagData); | ||
187 | } catch (\Exception $e) { | ||
188 | } | ||
189 | if (true === $e || [] === $e) { | ||
190 | continue; | ||
191 | } | ||
192 | if (\is_array($e) || 1 === \count($values)) { | ||
193 | foreach (\is_array($e) ? $e : array_keys($values) as $id) { | ||
194 | $ok = false; | ||
195 | $v = $values[$id]; | ||
196 | $type = get_debug_type($v); | ||
197 | $message = sprintf('Failed to save key "{key}" of type %s%s', $type, $e instanceof \Exception ? ': '.$e->getMessage() : '.'); | ||
198 | CacheItem::log($this->logger, $message, ['key' => substr($id, \strlen($this->namespace)), 'exception' => $e instanceof \Exception ? $e : null, 'cache-adapter' => get_debug_type($this)]); | ||
199 | } | ||
200 | } else { | ||
201 | foreach ($values as $id => $v) { | ||
202 | $retry[$lifetime][] = $id; | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | |||
207 | // When bulk-save failed, retry each item individually | ||
208 | foreach ($retry as $lifetime => $ids) { | ||
209 | foreach ($ids as $id) { | ||
210 | try { | ||
211 | $v = $byLifetime[$lifetime][$id]; | ||
212 | $values = $this->extractTagData([$id => $v], $addTagData, $removeTagData); | ||
213 | $e = $this->doSave($values, $lifetime, $addTagData, $removeTagData); | ||
214 | } catch (\Exception $e) { | ||
215 | } | ||
216 | if (true === $e || [] === $e) { | ||
217 | continue; | ||
218 | } | ||
219 | $ok = false; | ||
220 | $type = get_debug_type($v); | ||
221 | $message = sprintf('Failed to save key "{key}" of type %s%s', $type, $e instanceof \Exception ? ': '.$e->getMessage() : '.'); | ||
222 | CacheItem::log($this->logger, $message, ['key' => substr($id, \strlen($this->namespace)), 'exception' => $e instanceof \Exception ? $e : null, 'cache-adapter' => get_debug_type($this)]); | ||
223 | } | ||
224 | } | ||
225 | |||
226 | return $ok; | ||
227 | } | ||
228 | |||
229 | public function deleteItems(array $keys): bool | ||
230 | { | ||
231 | if (!$keys) { | ||
232 | return true; | ||
233 | } | ||
234 | |||
235 | $ok = true; | ||
236 | $ids = []; | ||
237 | $tagData = []; | ||
238 | |||
239 | foreach ($keys as $key) { | ||
240 | $ids[$key] = $this->getId($key); | ||
241 | unset($this->deferred[$key]); | ||
242 | } | ||
243 | |||
244 | try { | ||
245 | foreach ($this->doDeleteYieldTags(array_values($ids)) as $id => $tags) { | ||
246 | foreach ($tags as $tag) { | ||
247 | $tagData[$this->getId(self::TAGS_PREFIX.$tag)][] = $id; | ||
248 | } | ||
249 | } | ||
250 | } catch (\Exception) { | ||
251 | $ok = false; | ||
252 | } | ||
253 | |||
254 | try { | ||
255 | if ((!$tagData || $this->doDeleteTagRelations($tagData)) && $ok) { | ||
256 | return true; | ||
257 | } | ||
258 | } catch (\Exception) { | ||
259 | } | ||
260 | |||
261 | // When bulk-delete failed, retry each item individually | ||
262 | foreach ($ids as $key => $id) { | ||
263 | try { | ||
264 | $e = null; | ||
265 | if ($this->doDelete([$id])) { | ||
266 | continue; | ||
267 | } | ||
268 | } catch (\Exception $e) { | ||
269 | } | ||
270 | $message = 'Failed to delete key "{key}"'.($e instanceof \Exception ? ': '.$e->getMessage() : '.'); | ||
271 | CacheItem::log($this->logger, $message, ['key' => $key, 'exception' => $e, 'cache-adapter' => get_debug_type($this)]); | ||
272 | $ok = false; | ||
273 | } | ||
274 | |||
275 | return $ok; | ||
276 | } | ||
277 | |||
278 | public function invalidateTags(array $tags): bool | ||
279 | { | ||
280 | if (!$tags) { | ||
281 | return false; | ||
282 | } | ||
283 | |||
284 | $tagIds = []; | ||
285 | foreach (array_unique($tags) as $tag) { | ||
286 | $tagIds[] = $this->getId(self::TAGS_PREFIX.$tag); | ||
287 | } | ||
288 | |||
289 | try { | ||
290 | if ($this->doInvalidate($tagIds)) { | ||
291 | return true; | ||
292 | } | ||
293 | } catch (\Exception $e) { | ||
294 | CacheItem::log($this->logger, 'Failed to invalidate tags: '.$e->getMessage(), ['exception' => $e, 'cache-adapter' => get_debug_type($this)]); | ||
295 | } | ||
296 | |||
297 | return false; | ||
298 | } | ||
299 | |||
300 | /** | ||
301 | * Extracts tags operation data from $values set in mergeByLifetime, and returns values without it. | ||
302 | */ | ||
303 | private function extractTagData(array $values, ?array &$addTagData, ?array &$removeTagData): array | ||
304 | { | ||
305 | $addTagData = $removeTagData = []; | ||
306 | foreach ($values as $id => $value) { | ||
307 | foreach ($value['tag-operations']['add'] as $tag => $tagId) { | ||
308 | $addTagData[$tagId][] = $id; | ||
309 | } | ||
310 | |||
311 | foreach ($value['tag-operations']['remove'] as $tag => $tagId) { | ||
312 | $removeTagData[$tagId][] = $id; | ||
313 | } | ||
314 | |||
315 | unset($values[$id]['tag-operations']); | ||
316 | } | ||
317 | |||
318 | return $values; | ||
319 | } | ||
320 | } | ||
diff --git a/vendor/symfony/cache/Adapter/AdapterInterface.php b/vendor/symfony/cache/Adapter/AdapterInterface.php new file mode 100644 index 0000000..e556720 --- /dev/null +++ b/vendor/symfony/cache/Adapter/AdapterInterface.php | |||
@@ -0,0 +1,35 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Psr\Cache\CacheItemPoolInterface; | ||
15 | use Symfony\Component\Cache\CacheItem; | ||
16 | |||
17 | // Help opcache.preload discover always-needed symbols | ||
18 | class_exists(CacheItem::class); | ||
19 | |||
20 | /** | ||
21 | * Interface for adapters managing instances of Symfony's CacheItem. | ||
22 | * | ||
23 | * @author Kévin Dunglas <dunglas@gmail.com> | ||
24 | */ | ||
25 | interface AdapterInterface extends CacheItemPoolInterface | ||
26 | { | ||
27 | public function getItem(mixed $key): CacheItem; | ||
28 | |||
29 | /** | ||
30 | * @return iterable<string, CacheItem> | ||
31 | */ | ||
32 | public function getItems(array $keys = []): iterable; | ||
33 | |||
34 | public function clear(string $prefix = ''): bool; | ||
35 | } | ||
diff --git a/vendor/symfony/cache/Adapter/ApcuAdapter.php b/vendor/symfony/cache/Adapter/ApcuAdapter.php new file mode 100644 index 0000000..03b512f --- /dev/null +++ b/vendor/symfony/cache/Adapter/ApcuAdapter.php | |||
@@ -0,0 +1,116 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Symfony\Component\Cache\CacheItem; | ||
15 | use Symfony\Component\Cache\Exception\CacheException; | ||
16 | use Symfony\Component\Cache\Marshaller\MarshallerInterface; | ||
17 | |||
18 | /** | ||
19 | * @author Nicolas Grekas <p@tchwork.com> | ||
20 | */ | ||
21 | class ApcuAdapter extends AbstractAdapter | ||
22 | { | ||
23 | /** | ||
24 | * @throws CacheException if APCu is not enabled | ||
25 | */ | ||
26 | public function __construct( | ||
27 | string $namespace = '', | ||
28 | int $defaultLifetime = 0, | ||
29 | ?string $version = null, | ||
30 | private ?MarshallerInterface $marshaller = null, | ||
31 | ) { | ||
32 | if (!static::isSupported()) { | ||
33 | throw new CacheException('APCu is not enabled.'); | ||
34 | } | ||
35 | if ('cli' === \PHP_SAPI) { | ||
36 | ini_set('apc.use_request_time', 0); | ||
37 | } | ||
38 | parent::__construct($namespace, $defaultLifetime); | ||
39 | |||
40 | if (null !== $version) { | ||
41 | CacheItem::validateKey($version); | ||
42 | |||
43 | if (!apcu_exists($version.'@'.$namespace)) { | ||
44 | $this->doClear($namespace); | ||
45 | apcu_add($version.'@'.$namespace, null); | ||
46 | } | ||
47 | } | ||
48 | } | ||
49 | |||
50 | public static function isSupported(): bool | ||
51 | { | ||
52 | return \function_exists('apcu_fetch') && filter_var(\ini_get('apc.enabled'), \FILTER_VALIDATE_BOOL); | ||
53 | } | ||
54 | |||
55 | protected function doFetch(array $ids): iterable | ||
56 | { | ||
57 | $unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback'); | ||
58 | try { | ||
59 | $values = []; | ||
60 | foreach (apcu_fetch($ids, $ok) ?: [] as $k => $v) { | ||
61 | if (null !== $v || $ok) { | ||
62 | $values[$k] = null !== $this->marshaller ? $this->marshaller->unmarshall($v) : $v; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | return $values; | ||
67 | } catch (\Error $e) { | ||
68 | throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); | ||
69 | } finally { | ||
70 | ini_set('unserialize_callback_func', $unserializeCallbackHandler); | ||
71 | } | ||
72 | } | ||
73 | |||
74 | protected function doHave(string $id): bool | ||
75 | { | ||
76 | return apcu_exists($id); | ||
77 | } | ||
78 | |||
79 | protected function doClear(string $namespace): bool | ||
80 | { | ||
81 | return isset($namespace[0]) && class_exists(\APCUIterator::class, false) && ('cli' !== \PHP_SAPI || filter_var(\ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOL)) | ||
82 | ? apcu_delete(new \APCUIterator(sprintf('/^%s/', preg_quote($namespace, '/')), \APC_ITER_KEY)) | ||
83 | : apcu_clear_cache(); | ||
84 | } | ||
85 | |||
86 | protected function doDelete(array $ids): bool | ||
87 | { | ||
88 | foreach ($ids as $id) { | ||
89 | apcu_delete($id); | ||
90 | } | ||
91 | |||
92 | return true; | ||
93 | } | ||
94 | |||
95 | protected function doSave(array $values, int $lifetime): array|bool | ||
96 | { | ||
97 | if (null !== $this->marshaller && (!$values = $this->marshaller->marshall($values, $failed))) { | ||
98 | return $failed; | ||
99 | } | ||
100 | |||
101 | try { | ||
102 | if (false === $failures = apcu_store($values, null, $lifetime)) { | ||
103 | $failures = $values; | ||
104 | } | ||
105 | |||
106 | return array_keys($failures); | ||
107 | } catch (\Throwable $e) { | ||
108 | if (1 === \count($values)) { | ||
109 | // Workaround https://github.com/krakjoe/apcu/issues/170 | ||
110 | apcu_delete(array_key_first($values)); | ||
111 | } | ||
112 | |||
113 | throw $e; | ||
114 | } | ||
115 | } | ||
116 | } | ||
diff --git a/vendor/symfony/cache/Adapter/ArrayAdapter.php b/vendor/symfony/cache/Adapter/ArrayAdapter.php new file mode 100644 index 0000000..0f1c49d --- /dev/null +++ b/vendor/symfony/cache/Adapter/ArrayAdapter.php | |||
@@ -0,0 +1,359 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Psr\Cache\CacheItemInterface; | ||
15 | use Psr\Log\LoggerAwareInterface; | ||
16 | use Psr\Log\LoggerAwareTrait; | ||
17 | use Symfony\Component\Cache\CacheItem; | ||
18 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
19 | use Symfony\Component\Cache\ResettableInterface; | ||
20 | use Symfony\Contracts\Cache\CacheInterface; | ||
21 | |||
22 | /** | ||
23 | * An in-memory cache storage. | ||
24 | * | ||
25 | * Acts as a least-recently-used (LRU) storage when configured with a maximum number of items. | ||
26 | * | ||
27 | * @author Nicolas Grekas <p@tchwork.com> | ||
28 | */ | ||
29 | class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInterface, ResettableInterface | ||
30 | { | ||
31 | use LoggerAwareTrait; | ||
32 | |||
33 | private array $values = []; | ||
34 | private array $tags = []; | ||
35 | private array $expiries = []; | ||
36 | |||
37 | private static \Closure $createCacheItem; | ||
38 | |||
39 | /** | ||
40 | * @param bool $storeSerialized Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise | ||
41 | */ | ||
42 | public function __construct( | ||
43 | private int $defaultLifetime = 0, | ||
44 | private bool $storeSerialized = true, | ||
45 | private float $maxLifetime = 0, | ||
46 | private int $maxItems = 0, | ||
47 | ) { | ||
48 | if (0 > $maxLifetime) { | ||
49 | throw new InvalidArgumentException(sprintf('Argument $maxLifetime must be positive, %F passed.', $maxLifetime)); | ||
50 | } | ||
51 | |||
52 | if (0 > $maxItems) { | ||
53 | throw new InvalidArgumentException(sprintf('Argument $maxItems must be a positive integer, %d passed.', $maxItems)); | ||
54 | } | ||
55 | |||
56 | self::$createCacheItem ??= \Closure::bind( | ||
57 | static function ($key, $value, $isHit, $tags) { | ||
58 | $item = new CacheItem(); | ||
59 | $item->key = $key; | ||
60 | $item->value = $value; | ||
61 | $item->isHit = $isHit; | ||
62 | if (null !== $tags) { | ||
63 | $item->metadata[CacheItem::METADATA_TAGS] = $tags; | ||
64 | } | ||
65 | |||
66 | return $item; | ||
67 | }, | ||
68 | null, | ||
69 | CacheItem::class | ||
70 | ); | ||
71 | } | ||
72 | |||
73 | public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed | ||
74 | { | ||
75 | $item = $this->getItem($key); | ||
76 | $metadata = $item->getMetadata(); | ||
77 | |||
78 | // ArrayAdapter works in memory, we don't care about stampede protection | ||
79 | if (\INF === $beta || !$item->isHit()) { | ||
80 | $save = true; | ||
81 | $item->set($callback($item, $save)); | ||
82 | if ($save) { | ||
83 | $this->save($item); | ||
84 | } | ||
85 | } | ||
86 | |||
87 | return $item->get(); | ||
88 | } | ||
89 | |||
90 | public function delete(string $key): bool | ||
91 | { | ||
92 | return $this->deleteItem($key); | ||
93 | } | ||
94 | |||
95 | public function hasItem(mixed $key): bool | ||
96 | { | ||
97 | if (\is_string($key) && isset($this->expiries[$key]) && $this->expiries[$key] > microtime(true)) { | ||
98 | if ($this->maxItems) { | ||
99 | // Move the item last in the storage | ||
100 | $value = $this->values[$key]; | ||
101 | unset($this->values[$key]); | ||
102 | $this->values[$key] = $value; | ||
103 | } | ||
104 | |||
105 | return true; | ||
106 | } | ||
107 | \assert('' !== CacheItem::validateKey($key)); | ||
108 | |||
109 | return isset($this->expiries[$key]) && !$this->deleteItem($key); | ||
110 | } | ||
111 | |||
112 | public function getItem(mixed $key): CacheItem | ||
113 | { | ||
114 | if (!$isHit = $this->hasItem($key)) { | ||
115 | $value = null; | ||
116 | |||
117 | if (!$this->maxItems) { | ||
118 | // Track misses in non-LRU mode only | ||
119 | $this->values[$key] = null; | ||
120 | } | ||
121 | } else { | ||
122 | $value = $this->storeSerialized ? $this->unfreeze($key, $isHit) : $this->values[$key]; | ||
123 | } | ||
124 | |||
125 | return (self::$createCacheItem)($key, $value, $isHit, $this->tags[$key] ?? null); | ||
126 | } | ||
127 | |||
128 | public function getItems(array $keys = []): iterable | ||
129 | { | ||
130 | \assert(self::validateKeys($keys)); | ||
131 | |||
132 | return $this->generateItems($keys, microtime(true), self::$createCacheItem); | ||
133 | } | ||
134 | |||
135 | public function deleteItem(mixed $key): bool | ||
136 | { | ||
137 | \assert('' !== CacheItem::validateKey($key)); | ||
138 | unset($this->values[$key], $this->tags[$key], $this->expiries[$key]); | ||
139 | |||
140 | return true; | ||
141 | } | ||
142 | |||
143 | public function deleteItems(array $keys): bool | ||
144 | { | ||
145 | foreach ($keys as $key) { | ||
146 | $this->deleteItem($key); | ||
147 | } | ||
148 | |||
149 | return true; | ||
150 | } | ||
151 | |||
152 | public function save(CacheItemInterface $item): bool | ||
153 | { | ||
154 | if (!$item instanceof CacheItem) { | ||
155 | return false; | ||
156 | } | ||
157 | $item = (array) $item; | ||
158 | $key = $item["\0*\0key"]; | ||
159 | $value = $item["\0*\0value"]; | ||
160 | $expiry = $item["\0*\0expiry"]; | ||
161 | |||
162 | $now = microtime(true); | ||
163 | |||
164 | if (null !== $expiry) { | ||
165 | if (!$expiry) { | ||
166 | $expiry = \PHP_INT_MAX; | ||
167 | } elseif ($expiry <= $now) { | ||
168 | $this->deleteItem($key); | ||
169 | |||
170 | return true; | ||
171 | } | ||
172 | } | ||
173 | if ($this->storeSerialized && null === $value = $this->freeze($value, $key)) { | ||
174 | return false; | ||
175 | } | ||
176 | if (null === $expiry && 0 < $this->defaultLifetime) { | ||
177 | $expiry = $this->defaultLifetime; | ||
178 | $expiry = $now + ($expiry > ($this->maxLifetime ?: $expiry) ? $this->maxLifetime : $expiry); | ||
179 | } elseif ($this->maxLifetime && (null === $expiry || $expiry > $now + $this->maxLifetime)) { | ||
180 | $expiry = $now + $this->maxLifetime; | ||
181 | } | ||
182 | |||
183 | if ($this->maxItems) { | ||
184 | unset($this->values[$key], $this->tags[$key]); | ||
185 | |||
186 | // Iterate items and vacuum expired ones while we are at it | ||
187 | foreach ($this->values as $k => $v) { | ||
188 | if ($this->expiries[$k] > $now && \count($this->values) < $this->maxItems) { | ||
189 | break; | ||
190 | } | ||
191 | |||
192 | unset($this->values[$k], $this->tags[$k], $this->expiries[$k]); | ||
193 | } | ||
194 | } | ||
195 | |||
196 | $this->values[$key] = $value; | ||
197 | $this->expiries[$key] = $expiry ?? \PHP_INT_MAX; | ||
198 | |||
199 | if (null === $this->tags[$key] = $item["\0*\0newMetadata"][CacheItem::METADATA_TAGS] ?? null) { | ||
200 | unset($this->tags[$key]); | ||
201 | } | ||
202 | |||
203 | return true; | ||
204 | } | ||
205 | |||
206 | public function saveDeferred(CacheItemInterface $item): bool | ||
207 | { | ||
208 | return $this->save($item); | ||
209 | } | ||
210 | |||
211 | public function commit(): bool | ||
212 | { | ||
213 | return true; | ||
214 | } | ||
215 | |||
216 | public function clear(string $prefix = ''): bool | ||
217 | { | ||
218 | if ('' !== $prefix) { | ||
219 | $now = microtime(true); | ||
220 | |||
221 | foreach ($this->values as $key => $value) { | ||
222 | if (!isset($this->expiries[$key]) || $this->expiries[$key] <= $now || str_starts_with($key, $prefix)) { | ||
223 | unset($this->values[$key], $this->tags[$key], $this->expiries[$key]); | ||
224 | } | ||
225 | } | ||
226 | |||
227 | if ($this->values) { | ||
228 | return true; | ||
229 | } | ||
230 | } | ||
231 | |||
232 | $this->values = $this->tags = $this->expiries = []; | ||
233 | |||
234 | return true; | ||
235 | } | ||
236 | |||
237 | /** | ||
238 | * Returns all cached values, with cache miss as null. | ||
239 | */ | ||
240 | public function getValues(): array | ||
241 | { | ||
242 | if (!$this->storeSerialized) { | ||
243 | return $this->values; | ||
244 | } | ||
245 | |||
246 | $values = $this->values; | ||
247 | foreach ($values as $k => $v) { | ||
248 | if (null === $v || 'N;' === $v) { | ||
249 | continue; | ||
250 | } | ||
251 | if (!\is_string($v) || !isset($v[2]) || ':' !== $v[1]) { | ||
252 | $values[$k] = serialize($v); | ||
253 | } | ||
254 | } | ||
255 | |||
256 | return $values; | ||
257 | } | ||
258 | |||
259 | public function reset(): void | ||
260 | { | ||
261 | $this->clear(); | ||
262 | } | ||
263 | |||
264 | private function generateItems(array $keys, float $now, \Closure $f): \Generator | ||
265 | { | ||
266 | foreach ($keys as $i => $key) { | ||
267 | if (!$isHit = isset($this->expiries[$key]) && ($this->expiries[$key] > $now || !$this->deleteItem($key))) { | ||
268 | $value = null; | ||
269 | |||
270 | if (!$this->maxItems) { | ||
271 | // Track misses in non-LRU mode only | ||
272 | $this->values[$key] = null; | ||
273 | } | ||
274 | } else { | ||
275 | if ($this->maxItems) { | ||
276 | // Move the item last in the storage | ||
277 | $value = $this->values[$key]; | ||
278 | unset($this->values[$key]); | ||
279 | $this->values[$key] = $value; | ||
280 | } | ||
281 | |||
282 | $value = $this->storeSerialized ? $this->unfreeze($key, $isHit) : $this->values[$key]; | ||
283 | } | ||
284 | unset($keys[$i]); | ||
285 | |||
286 | yield $key => $f($key, $value, $isHit, $this->tags[$key] ?? null); | ||
287 | } | ||
288 | |||
289 | foreach ($keys as $key) { | ||
290 | yield $key => $f($key, null, false); | ||
291 | } | ||
292 | } | ||
293 | |||
294 | private function freeze($value, string $key): string|int|float|bool|array|\UnitEnum|null | ||
295 | { | ||
296 | if (null === $value) { | ||
297 | return 'N;'; | ||
298 | } | ||
299 | if (\is_string($value)) { | ||
300 | // Serialize strings if they could be confused with serialized objects or arrays | ||
301 | if ('N;' === $value || (isset($value[2]) && ':' === $value[1])) { | ||
302 | return serialize($value); | ||
303 | } | ||
304 | } elseif (!\is_scalar($value)) { | ||
305 | try { | ||
306 | $serialized = serialize($value); | ||
307 | } catch (\Exception $e) { | ||
308 | unset($this->values[$key], $this->tags[$key]); | ||
309 | $type = get_debug_type($value); | ||
310 | $message = sprintf('Failed to save key "{key}" of type %s: %s', $type, $e->getMessage()); | ||
311 | CacheItem::log($this->logger, $message, ['key' => $key, 'exception' => $e, 'cache-adapter' => get_debug_type($this)]); | ||
312 | |||
313 | return null; | ||
314 | } | ||
315 | // Keep value serialized if it contains any objects or any internal references | ||
316 | if ('C' === $serialized[0] || 'O' === $serialized[0] || preg_match('/;[OCRr]:[1-9]/', $serialized)) { | ||
317 | return $serialized; | ||
318 | } | ||
319 | } | ||
320 | |||
321 | return $value; | ||
322 | } | ||
323 | |||
324 | private function unfreeze(string $key, bool &$isHit): mixed | ||
325 | { | ||
326 | if ('N;' === $value = $this->values[$key]) { | ||
327 | return null; | ||
328 | } | ||
329 | if (\is_string($value) && isset($value[2]) && ':' === $value[1]) { | ||
330 | try { | ||
331 | $value = unserialize($value); | ||
332 | } catch (\Exception $e) { | ||
333 | CacheItem::log($this->logger, 'Failed to unserialize key "{key}": '.$e->getMessage(), ['key' => $key, 'exception' => $e, 'cache-adapter' => get_debug_type($this)]); | ||
334 | $value = false; | ||
335 | } | ||
336 | if (false === $value) { | ||
337 | $value = null; | ||
338 | $isHit = false; | ||
339 | |||
340 | if (!$this->maxItems) { | ||
341 | $this->values[$key] = null; | ||
342 | } | ||
343 | } | ||
344 | } | ||
345 | |||
346 | return $value; | ||
347 | } | ||
348 | |||
349 | private function validateKeys(array $keys): bool | ||
350 | { | ||
351 | foreach ($keys as $key) { | ||
352 | if (!\is_string($key) || !isset($this->expiries[$key])) { | ||
353 | CacheItem::validateKey($key); | ||
354 | } | ||
355 | } | ||
356 | |||
357 | return true; | ||
358 | } | ||
359 | } | ||
diff --git a/vendor/symfony/cache/Adapter/ChainAdapter.php b/vendor/symfony/cache/Adapter/ChainAdapter.php new file mode 100644 index 0000000..1418cff --- /dev/null +++ b/vendor/symfony/cache/Adapter/ChainAdapter.php | |||
@@ -0,0 +1,291 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Psr\Cache\CacheItemInterface; | ||
15 | use Psr\Cache\CacheItemPoolInterface; | ||
16 | use Symfony\Component\Cache\CacheItem; | ||
17 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
18 | use Symfony\Component\Cache\PruneableInterface; | ||
19 | use Symfony\Component\Cache\ResettableInterface; | ||
20 | use Symfony\Component\Cache\Traits\ContractsTrait; | ||
21 | use Symfony\Contracts\Cache\CacheInterface; | ||
22 | use Symfony\Contracts\Service\ResetInterface; | ||
23 | |||
24 | /** | ||
25 | * Chains several adapters together. | ||
26 | * | ||
27 | * Cached items are fetched from the first adapter having them in its data store. | ||
28 | * They are saved and deleted in all adapters at once. | ||
29 | * | ||
30 | * @author Kévin Dunglas <dunglas@gmail.com> | ||
31 | */ | ||
32 | class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterface, ResettableInterface | ||
33 | { | ||
34 | use ContractsTrait; | ||
35 | |||
36 | private array $adapters = []; | ||
37 | private int $adapterCount; | ||
38 | |||
39 | private static \Closure $syncItem; | ||
40 | |||
41 | /** | ||
42 | * @param CacheItemPoolInterface[] $adapters The ordered list of adapters used to fetch cached items | ||
43 | * @param int $defaultLifetime The default lifetime of items propagated from lower adapters to upper ones | ||
44 | */ | ||
45 | public function __construct( | ||
46 | array $adapters, | ||
47 | private int $defaultLifetime = 0, | ||
48 | ) { | ||
49 | if (!$adapters) { | ||
50 | throw new InvalidArgumentException('At least one adapter must be specified.'); | ||
51 | } | ||
52 | |||
53 | foreach ($adapters as $adapter) { | ||
54 | if (!$adapter instanceof CacheItemPoolInterface) { | ||
55 | throw new InvalidArgumentException(sprintf('The class "%s" does not implement the "%s" interface.', get_debug_type($adapter), CacheItemPoolInterface::class)); | ||
56 | } | ||
57 | if ('cli' === \PHP_SAPI && $adapter instanceof ApcuAdapter && !filter_var(\ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOL)) { | ||
58 | continue; // skip putting APCu in the chain when the backend is disabled | ||
59 | } | ||
60 | |||
61 | if ($adapter instanceof AdapterInterface) { | ||
62 | $this->adapters[] = $adapter; | ||
63 | } else { | ||
64 | $this->adapters[] = new ProxyAdapter($adapter); | ||
65 | } | ||
66 | } | ||
67 | $this->adapterCount = \count($this->adapters); | ||
68 | |||
69 | self::$syncItem ??= \Closure::bind( | ||
70 | static function ($sourceItem, $item, $defaultLifetime, $sourceMetadata = null) { | ||
71 | $sourceItem->isTaggable = false; | ||
72 | $sourceMetadata ??= $sourceItem->metadata; | ||
73 | |||
74 | $item->value = $sourceItem->value; | ||
75 | $item->isHit = $sourceItem->isHit; | ||
76 | $item->metadata = $item->newMetadata = $sourceItem->metadata = $sourceMetadata; | ||
77 | |||
78 | if (isset($item->metadata[CacheItem::METADATA_EXPIRY])) { | ||
79 | $item->expiresAt(\DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $item->metadata[CacheItem::METADATA_EXPIRY]))); | ||
80 | } elseif (0 < $defaultLifetime) { | ||
81 | $item->expiresAfter($defaultLifetime); | ||
82 | } | ||
83 | |||
84 | return $item; | ||
85 | }, | ||
86 | null, | ||
87 | CacheItem::class | ||
88 | ); | ||
89 | } | ||
90 | |||
91 | public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed | ||
92 | { | ||
93 | $doSave = true; | ||
94 | $callback = static function (CacheItem $item, bool &$save) use ($callback, &$doSave) { | ||
95 | $value = $callback($item, $save); | ||
96 | $doSave = $save; | ||
97 | |||
98 | return $value; | ||
99 | }; | ||
100 | |||
101 | $wrap = function (?CacheItem $item = null, bool &$save = true) use ($key, $callback, $beta, &$wrap, &$doSave, &$metadata) { | ||
102 | static $lastItem; | ||
103 | static $i = 0; | ||
104 | $adapter = $this->adapters[$i]; | ||
105 | if (isset($this->adapters[++$i])) { | ||
106 | $callback = $wrap; | ||
107 | $beta = \INF === $beta ? \INF : 0; | ||
108 | } | ||
109 | if ($adapter instanceof CacheInterface) { | ||
110 | $value = $adapter->get($key, $callback, $beta, $metadata); | ||
111 | } else { | ||
112 | $value = $this->doGet($adapter, $key, $callback, $beta, $metadata); | ||
113 | } | ||
114 | if (null !== $item) { | ||
115 | (self::$syncItem)($lastItem ??= $item, $item, $this->defaultLifetime, $metadata); | ||
116 | } | ||
117 | $save = $doSave; | ||
118 | |||
119 | return $value; | ||
120 | }; | ||
121 | |||
122 | return $wrap(); | ||
123 | } | ||
124 | |||
125 | public function getItem(mixed $key): CacheItem | ||
126 | { | ||
127 | $syncItem = self::$syncItem; | ||
128 | $misses = []; | ||
129 | |||
130 | foreach ($this->adapters as $i => $adapter) { | ||
131 | $item = $adapter->getItem($key); | ||
132 | |||
133 | if ($item->isHit()) { | ||
134 | while (0 <= --$i) { | ||
135 | $this->adapters[$i]->save($syncItem($item, $misses[$i], $this->defaultLifetime)); | ||
136 | } | ||
137 | |||
138 | return $item; | ||
139 | } | ||
140 | |||
141 | $misses[$i] = $item; | ||
142 | } | ||
143 | |||
144 | return $item; | ||
145 | } | ||
146 | |||
147 | public function getItems(array $keys = []): iterable | ||
148 | { | ||
149 | return $this->generateItems($this->adapters[0]->getItems($keys), 0); | ||
150 | } | ||
151 | |||
152 | private function generateItems(iterable $items, int $adapterIndex): \Generator | ||
153 | { | ||
154 | $missing = []; | ||
155 | $misses = []; | ||
156 | $nextAdapterIndex = $adapterIndex + 1; | ||
157 | $nextAdapter = $this->adapters[$nextAdapterIndex] ?? null; | ||
158 | |||
159 | foreach ($items as $k => $item) { | ||
160 | if (!$nextAdapter || $item->isHit()) { | ||
161 | yield $k => $item; | ||
162 | } else { | ||
163 | $missing[] = $k; | ||
164 | $misses[$k] = $item; | ||
165 | } | ||
166 | } | ||
167 | |||
168 | if ($missing) { | ||
169 | $syncItem = self::$syncItem; | ||
170 | $adapter = $this->adapters[$adapterIndex]; | ||
171 | $items = $this->generateItems($nextAdapter->getItems($missing), $nextAdapterIndex); | ||
172 | |||
173 | foreach ($items as $k => $item) { | ||
174 | if ($item->isHit()) { | ||
175 | $adapter->save($syncItem($item, $misses[$k], $this->defaultLifetime)); | ||
176 | } | ||
177 | |||
178 | yield $k => $item; | ||
179 | } | ||
180 | } | ||
181 | } | ||
182 | |||
183 | public function hasItem(mixed $key): bool | ||
184 | { | ||
185 | foreach ($this->adapters as $adapter) { | ||
186 | if ($adapter->hasItem($key)) { | ||
187 | return true; | ||
188 | } | ||
189 | } | ||
190 | |||
191 | return false; | ||
192 | } | ||
193 | |||
194 | public function clear(string $prefix = ''): bool | ||
195 | { | ||
196 | $cleared = true; | ||
197 | $i = $this->adapterCount; | ||
198 | |||
199 | while ($i--) { | ||
200 | if ($this->adapters[$i] instanceof AdapterInterface) { | ||
201 | $cleared = $this->adapters[$i]->clear($prefix) && $cleared; | ||
202 | } else { | ||
203 | $cleared = $this->adapters[$i]->clear() && $cleared; | ||
204 | } | ||
205 | } | ||
206 | |||
207 | return $cleared; | ||
208 | } | ||
209 | |||
210 | public function deleteItem(mixed $key): bool | ||
211 | { | ||
212 | $deleted = true; | ||
213 | $i = $this->adapterCount; | ||
214 | |||
215 | while ($i--) { | ||
216 | $deleted = $this->adapters[$i]->deleteItem($key) && $deleted; | ||
217 | } | ||
218 | |||
219 | return $deleted; | ||
220 | } | ||
221 | |||
222 | public function deleteItems(array $keys): bool | ||
223 | { | ||
224 | $deleted = true; | ||
225 | $i = $this->adapterCount; | ||
226 | |||
227 | while ($i--) { | ||
228 | $deleted = $this->adapters[$i]->deleteItems($keys) && $deleted; | ||
229 | } | ||
230 | |||
231 | return $deleted; | ||
232 | } | ||
233 | |||
234 | public function save(CacheItemInterface $item): bool | ||
235 | { | ||
236 | $saved = true; | ||
237 | $i = $this->adapterCount; | ||
238 | |||
239 | while ($i--) { | ||
240 | $saved = $this->adapters[$i]->save($item) && $saved; | ||
241 | } | ||
242 | |||
243 | return $saved; | ||
244 | } | ||
245 | |||
246 | public function saveDeferred(CacheItemInterface $item): bool | ||
247 | { | ||
248 | $saved = true; | ||
249 | $i = $this->adapterCount; | ||
250 | |||
251 | while ($i--) { | ||
252 | $saved = $this->adapters[$i]->saveDeferred($item) && $saved; | ||
253 | } | ||
254 | |||
255 | return $saved; | ||
256 | } | ||
257 | |||
258 | public function commit(): bool | ||
259 | { | ||
260 | $committed = true; | ||
261 | $i = $this->adapterCount; | ||
262 | |||
263 | while ($i--) { | ||
264 | $committed = $this->adapters[$i]->commit() && $committed; | ||
265 | } | ||
266 | |||
267 | return $committed; | ||
268 | } | ||
269 | |||
270 | public function prune(): bool | ||
271 | { | ||
272 | $pruned = true; | ||
273 | |||
274 | foreach ($this->adapters as $adapter) { | ||
275 | if ($adapter instanceof PruneableInterface) { | ||
276 | $pruned = $adapter->prune() && $pruned; | ||
277 | } | ||
278 | } | ||
279 | |||
280 | return $pruned; | ||
281 | } | ||
282 | |||
283 | public function reset(): void | ||
284 | { | ||
285 | foreach ($this->adapters as $adapter) { | ||
286 | if ($adapter instanceof ResetInterface) { | ||
287 | $adapter->reset(); | ||
288 | } | ||
289 | } | ||
290 | } | ||
291 | } | ||
diff --git a/vendor/symfony/cache/Adapter/CouchbaseBucketAdapter.php b/vendor/symfony/cache/Adapter/CouchbaseBucketAdapter.php new file mode 100644 index 0000000..106d7fd --- /dev/null +++ b/vendor/symfony/cache/Adapter/CouchbaseBucketAdapter.php | |||
@@ -0,0 +1,237 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Symfony\Component\Cache\Exception\CacheException; | ||
15 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
16 | use Symfony\Component\Cache\Marshaller\DefaultMarshaller; | ||
17 | use Symfony\Component\Cache\Marshaller\MarshallerInterface; | ||
18 | |||
19 | trigger_deprecation('symfony/cache', '7.1', 'The "%s" class is deprecated, use "%s" instead.', CouchbaseBucketAdapter::class, CouchbaseCollectionAdapter::class); | ||
20 | |||
21 | /** | ||
22 | * @author Antonio Jose Cerezo Aranda <aj.cerezo@gmail.com> | ||
23 | * | ||
24 | * @deprecated since Symfony 7.1, use {@see CouchbaseCollectionAdapter} instead | ||
25 | */ | ||
26 | class CouchbaseBucketAdapter extends AbstractAdapter | ||
27 | { | ||
28 | private const THIRTY_DAYS_IN_SECONDS = 2592000; | ||
29 | private const MAX_KEY_LENGTH = 250; | ||
30 | private const KEY_NOT_FOUND = 13; | ||
31 | private const VALID_DSN_OPTIONS = [ | ||
32 | 'operationTimeout', | ||
33 | 'configTimeout', | ||
34 | 'configNodeTimeout', | ||
35 | 'n1qlTimeout', | ||
36 | 'httpTimeout', | ||
37 | 'configDelay', | ||
38 | 'htconfigIdleTimeout', | ||
39 | 'durabilityInterval', | ||
40 | 'durabilityTimeout', | ||
41 | ]; | ||
42 | |||
43 | private MarshallerInterface $marshaller; | ||
44 | |||
45 | public function __construct( | ||
46 | private \CouchbaseBucket $bucket, | ||
47 | string $namespace = '', | ||
48 | int $defaultLifetime = 0, | ||
49 | ?MarshallerInterface $marshaller = null, | ||
50 | ) { | ||
51 | if (!static::isSupported()) { | ||
52 | throw new CacheException('Couchbase >= 2.6.0 < 3.0.0 is required.'); | ||
53 | } | ||
54 | |||
55 | $this->maxIdLength = static::MAX_KEY_LENGTH; | ||
56 | |||
57 | parent::__construct($namespace, $defaultLifetime); | ||
58 | $this->enableVersioning(); | ||
59 | $this->marshaller = $marshaller ?? new DefaultMarshaller(); | ||
60 | } | ||
61 | |||
62 | public static function createConnection(#[\SensitiveParameter] array|string $servers, array $options = []): \CouchbaseBucket | ||
63 | { | ||
64 | if (\is_string($servers)) { | ||
65 | $servers = [$servers]; | ||
66 | } | ||
67 | |||
68 | if (!static::isSupported()) { | ||
69 | throw new CacheException('Couchbase >= 2.6.0 < 3.0.0 is required.'); | ||
70 | } | ||
71 | |||
72 | set_error_handler(static fn ($type, $msg, $file, $line) => throw new \ErrorException($msg, 0, $type, $file, $line)); | ||
73 | |||
74 | $dsnPattern = '/^(?<protocol>couchbase(?:s)?)\:\/\/(?:(?<username>[^\:]+)\:(?<password>[^\@]{6,})@)?' | ||
75 | .'(?<host>[^\:]+(?:\:\d+)?)(?:\/(?<bucketName>[^\?]+))(?:\?(?<options>.*))?$/i'; | ||
76 | |||
77 | $newServers = []; | ||
78 | $protocol = 'couchbase'; | ||
79 | try { | ||
80 | $options = self::initOptions($options); | ||
81 | $username = $options['username']; | ||
82 | $password = $options['password']; | ||
83 | |||
84 | foreach ($servers as $dsn) { | ||
85 | if (!str_starts_with($dsn, 'couchbase:')) { | ||
86 | throw new InvalidArgumentException('Invalid Couchbase DSN: it does not start with "couchbase:".'); | ||
87 | } | ||
88 | |||
89 | preg_match($dsnPattern, $dsn, $matches); | ||
90 | |||
91 | $username = $matches['username'] ?: $username; | ||
92 | $password = $matches['password'] ?: $password; | ||
93 | $protocol = $matches['protocol'] ?: $protocol; | ||
94 | |||
95 | if (isset($matches['options'])) { | ||
96 | $optionsInDsn = self::getOptions($matches['options']); | ||
97 | |||
98 | foreach ($optionsInDsn as $parameter => $value) { | ||
99 | $options[$parameter] = $value; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | $newServers[] = $matches['host']; | ||
104 | } | ||
105 | |||
106 | $connectionString = $protocol.'://'.implode(',', $newServers); | ||
107 | |||
108 | $client = new \CouchbaseCluster($connectionString); | ||
109 | $client->authenticateAs($username, $password); | ||
110 | |||
111 | $bucket = $client->openBucket($matches['bucketName']); | ||
112 | |||
113 | unset($options['username'], $options['password']); | ||
114 | foreach ($options as $option => $value) { | ||
115 | if ($value) { | ||
116 | $bucket->$option = $value; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | return $bucket; | ||
121 | } finally { | ||
122 | restore_error_handler(); | ||
123 | } | ||
124 | } | ||
125 | |||
126 | public static function isSupported(): bool | ||
127 | { | ||
128 | return \extension_loaded('couchbase') && version_compare(phpversion('couchbase'), '2.6.0', '>=') && version_compare(phpversion('couchbase'), '3.0', '<'); | ||
129 | } | ||
130 | |||
131 | private static function getOptions(string $options): array | ||
132 | { | ||
133 | $results = []; | ||
134 | $optionsInArray = explode('&', $options); | ||
135 | |||
136 | foreach ($optionsInArray as $option) { | ||
137 | [$key, $value] = explode('=', $option); | ||
138 | |||
139 | if (\in_array($key, static::VALID_DSN_OPTIONS, true)) { | ||
140 | $results[$key] = $value; | ||
141 | } | ||
142 | } | ||
143 | |||
144 | return $results; | ||
145 | } | ||
146 | |||
147 | private static function initOptions(array $options): array | ||
148 | { | ||
149 | $options['username'] ??= ''; | ||
150 | $options['password'] ??= ''; | ||
151 | $options['operationTimeout'] ??= 0; | ||
152 | $options['configTimeout'] ??= 0; | ||
153 | $options['configNodeTimeout'] ??= 0; | ||
154 | $options['n1qlTimeout'] ??= 0; | ||
155 | $options['httpTimeout'] ??= 0; | ||
156 | $options['configDelay'] ??= 0; | ||
157 | $options['htconfigIdleTimeout'] ??= 0; | ||
158 | $options['durabilityInterval'] ??= 0; | ||
159 | $options['durabilityTimeout'] ??= 0; | ||
160 | |||
161 | return $options; | ||
162 | } | ||
163 | |||
164 | protected function doFetch(array $ids): iterable | ||
165 | { | ||
166 | $resultsCouchbase = $this->bucket->get($ids); | ||
167 | |||
168 | $results = []; | ||
169 | foreach ($resultsCouchbase as $key => $value) { | ||
170 | if (null !== $value->error) { | ||
171 | continue; | ||
172 | } | ||
173 | $results[$key] = $this->marshaller->unmarshall($value->value); | ||
174 | } | ||
175 | |||
176 | return $results; | ||
177 | } | ||
178 | |||
179 | protected function doHave(string $id): bool | ||
180 | { | ||
181 | return false !== $this->bucket->get($id); | ||
182 | } | ||
183 | |||
184 | protected function doClear(string $namespace): bool | ||
185 | { | ||
186 | if ('' === $namespace) { | ||
187 | $this->bucket->manager()->flush(); | ||
188 | |||
189 | return true; | ||
190 | } | ||
191 | |||
192 | return false; | ||
193 | } | ||
194 | |||
195 | protected function doDelete(array $ids): bool | ||
196 | { | ||
197 | $results = $this->bucket->remove(array_values($ids)); | ||
198 | |||
199 | foreach ($results as $key => $result) { | ||
200 | if (null !== $result->error && static::KEY_NOT_FOUND !== $result->error->getCode()) { | ||
201 | continue; | ||
202 | } | ||
203 | unset($results[$key]); | ||
204 | } | ||
205 | |||
206 | return 0 === \count($results); | ||
207 | } | ||
208 | |||
209 | protected function doSave(array $values, int $lifetime): array|bool | ||
210 | { | ||
211 | if (!$values = $this->marshaller->marshall($values, $failed)) { | ||
212 | return $failed; | ||
213 | } | ||
214 | |||
215 | $lifetime = $this->normalizeExpiry($lifetime); | ||
216 | |||
217 | $ko = []; | ||
218 | foreach ($values as $key => $value) { | ||
219 | $result = $this->bucket->upsert($key, $value, ['expiry' => $lifetime]); | ||
220 | |||
221 | if (null !== $result->error) { | ||
222 | $ko[$key] = $result; | ||
223 | } | ||
224 | } | ||
225 | |||
226 | return [] === $ko ? true : $ko; | ||
227 | } | ||
228 | |||
229 | private function normalizeExpiry(int $expiry): int | ||
230 | { | ||
231 | if ($expiry && $expiry > static::THIRTY_DAYS_IN_SECONDS) { | ||
232 | $expiry += time(); | ||
233 | } | ||
234 | |||
235 | return $expiry; | ||
236 | } | ||
237 | } | ||
diff --git a/vendor/symfony/cache/Adapter/CouchbaseCollectionAdapter.php b/vendor/symfony/cache/Adapter/CouchbaseCollectionAdapter.php new file mode 100644 index 0000000..9646bc3 --- /dev/null +++ b/vendor/symfony/cache/Adapter/CouchbaseCollectionAdapter.php | |||
@@ -0,0 +1,198 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Couchbase\Bucket; | ||
15 | use Couchbase\Cluster; | ||
16 | use Couchbase\ClusterOptions; | ||
17 | use Couchbase\Collection; | ||
18 | use Couchbase\DocumentNotFoundException; | ||
19 | use Couchbase\UpsertOptions; | ||
20 | use Symfony\Component\Cache\Exception\CacheException; | ||
21 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
22 | use Symfony\Component\Cache\Marshaller\DefaultMarshaller; | ||
23 | use Symfony\Component\Cache\Marshaller\MarshallerInterface; | ||
24 | |||
25 | /** | ||
26 | * @author Antonio Jose Cerezo Aranda <aj.cerezo@gmail.com> | ||
27 | */ | ||
28 | class CouchbaseCollectionAdapter extends AbstractAdapter | ||
29 | { | ||
30 | private const MAX_KEY_LENGTH = 250; | ||
31 | |||
32 | private MarshallerInterface $marshaller; | ||
33 | |||
34 | public function __construct( | ||
35 | private Collection $connection, | ||
36 | string $namespace = '', | ||
37 | int $defaultLifetime = 0, | ||
38 | ?MarshallerInterface $marshaller = null, | ||
39 | ) { | ||
40 | if (!static::isSupported()) { | ||
41 | throw new CacheException('Couchbase >= 3.0.5 < 4.0.0 is required.'); | ||
42 | } | ||
43 | |||
44 | $this->maxIdLength = static::MAX_KEY_LENGTH; | ||
45 | |||
46 | parent::__construct($namespace, $defaultLifetime); | ||
47 | $this->enableVersioning(); | ||
48 | $this->marshaller = $marshaller ?? new DefaultMarshaller(); | ||
49 | } | ||
50 | |||
51 | public static function createConnection(#[\SensitiveParameter] array|string $dsn, array $options = []): Bucket|Collection | ||
52 | { | ||
53 | if (\is_string($dsn)) { | ||
54 | $dsn = [$dsn]; | ||
55 | } | ||
56 | |||
57 | if (!static::isSupported()) { | ||
58 | throw new CacheException('Couchbase >= 3.0.5 < 4.0.0 is required.'); | ||
59 | } | ||
60 | |||
61 | set_error_handler(static fn ($type, $msg, $file, $line) => throw new \ErrorException($msg, 0, $type, $file, $line)); | ||
62 | |||
63 | $pathPattern = '/^(?:\/(?<bucketName>[^\/\?]+))(?:(?:\/(?<scopeName>[^\/]+))(?:\/(?<collectionName>[^\/\?]+)))?(?:\/)?$/'; | ||
64 | $newServers = []; | ||
65 | $protocol = 'couchbase'; | ||
66 | try { | ||
67 | $username = $options['username'] ?? ''; | ||
68 | $password = $options['password'] ?? ''; | ||
69 | |||
70 | foreach ($dsn as $server) { | ||
71 | if (!str_starts_with($server, 'couchbase:')) { | ||
72 | throw new InvalidArgumentException('Invalid Couchbase DSN: it does not start with "couchbase:".'); | ||
73 | } | ||
74 | |||
75 | $params = parse_url($server); | ||
76 | |||
77 | $username = isset($params['user']) ? rawurldecode($params['user']) : $username; | ||
78 | $password = isset($params['pass']) ? rawurldecode($params['pass']) : $password; | ||
79 | $protocol = $params['scheme'] ?? $protocol; | ||
80 | |||
81 | if (isset($params['query'])) { | ||
82 | $optionsInDsn = self::getOptions($params['query']); | ||
83 | |||
84 | foreach ($optionsInDsn as $parameter => $value) { | ||
85 | $options[$parameter] = $value; | ||
86 | } | ||
87 | } | ||
88 | |||
89 | $newServers[] = $params['host']; | ||
90 | } | ||
91 | |||
92 | $option = isset($params['query']) ? '?'.$params['query'] : ''; | ||
93 | $connectionString = $protocol.'://'.implode(',', $newServers).$option; | ||
94 | |||
95 | $clusterOptions = new ClusterOptions(); | ||
96 | $clusterOptions->credentials($username, $password); | ||
97 | |||
98 | $client = new Cluster($connectionString, $clusterOptions); | ||
99 | |||
100 | preg_match($pathPattern, $params['path'] ?? '', $matches); | ||
101 | $bucket = $client->bucket($matches['bucketName']); | ||
102 | $collection = $bucket->defaultCollection(); | ||
103 | if (!empty($matches['scopeName'])) { | ||
104 | $scope = $bucket->scope($matches['scopeName']); | ||
105 | $collection = $scope->collection($matches['collectionName']); | ||
106 | } | ||
107 | |||
108 | return $collection; | ||
109 | } finally { | ||
110 | restore_error_handler(); | ||
111 | } | ||
112 | } | ||
113 | |||
114 | public static function isSupported(): bool | ||
115 | { | ||
116 | return \extension_loaded('couchbase') && version_compare(phpversion('couchbase'), '3.0.5', '>=') && version_compare(phpversion('couchbase'), '4.0', '<'); | ||
117 | } | ||
118 | |||
119 | private static function getOptions(string $options): array | ||
120 | { | ||
121 | $results = []; | ||
122 | $optionsInArray = explode('&', $options); | ||
123 | |||
124 | foreach ($optionsInArray as $option) { | ||
125 | [$key, $value] = explode('=', $option); | ||
126 | |||
127 | $results[$key] = $value; | ||
128 | } | ||
129 | |||
130 | return $results; | ||
131 | } | ||
132 | |||
133 | protected function doFetch(array $ids): array | ||
134 | { | ||
135 | $results = []; | ||
136 | foreach ($ids as $id) { | ||
137 | try { | ||
138 | $resultCouchbase = $this->connection->get($id); | ||
139 | } catch (DocumentNotFoundException) { | ||
140 | continue; | ||
141 | } | ||
142 | |||
143 | $content = $resultCouchbase->value ?? $resultCouchbase->content(); | ||
144 | |||
145 | $results[$id] = $this->marshaller->unmarshall($content); | ||
146 | } | ||
147 | |||
148 | return $results; | ||
149 | } | ||
150 | |||
151 | protected function doHave($id): bool | ||
152 | { | ||
153 | return $this->connection->exists($id)->exists(); | ||
154 | } | ||
155 | |||
156 | protected function doClear($namespace): bool | ||
157 | { | ||
158 | return false; | ||
159 | } | ||
160 | |||
161 | protected function doDelete(array $ids): bool | ||
162 | { | ||
163 | $idsErrors = []; | ||
164 | foreach ($ids as $id) { | ||
165 | try { | ||
166 | $result = $this->connection->remove($id); | ||
167 | |||
168 | if (null === $result->mutationToken()) { | ||
169 | $idsErrors[] = $id; | ||
170 | } | ||
171 | } catch (DocumentNotFoundException) { | ||
172 | } | ||
173 | } | ||
174 | |||
175 | return 0 === \count($idsErrors); | ||
176 | } | ||
177 | |||
178 | protected function doSave(array $values, $lifetime): array|bool | ||
179 | { | ||
180 | if (!$values = $this->marshaller->marshall($values, $failed)) { | ||
181 | return $failed; | ||
182 | } | ||
183 | |||
184 | $upsertOptions = new UpsertOptions(); | ||
185 | $upsertOptions->expiry($lifetime); | ||
186 | |||
187 | $ko = []; | ||
188 | foreach ($values as $key => $value) { | ||
189 | try { | ||
190 | $this->connection->upsert($key, $value, $upsertOptions); | ||
191 | } catch (\Exception) { | ||
192 | $ko[$key] = ''; | ||
193 | } | ||
194 | } | ||
195 | |||
196 | return [] === $ko ? true : $ko; | ||
197 | } | ||
198 | } | ||
diff --git a/vendor/symfony/cache/Adapter/DoctrineDbalAdapter.php b/vendor/symfony/cache/Adapter/DoctrineDbalAdapter.php new file mode 100644 index 0000000..ae2bea7 --- /dev/null +++ b/vendor/symfony/cache/Adapter/DoctrineDbalAdapter.php | |||
@@ -0,0 +1,383 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Doctrine\DBAL\ArrayParameterType; | ||
15 | use Doctrine\DBAL\Configuration; | ||
16 | use Doctrine\DBAL\Connection; | ||
17 | use Doctrine\DBAL\DriverManager; | ||
18 | use Doctrine\DBAL\Exception as DBALException; | ||
19 | use Doctrine\DBAL\Exception\TableNotFoundException; | ||
20 | use Doctrine\DBAL\ParameterType; | ||
21 | use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory; | ||
22 | use Doctrine\DBAL\Schema\Schema; | ||
23 | use Doctrine\DBAL\Tools\DsnParser; | ||
24 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
25 | use Symfony\Component\Cache\Marshaller\DefaultMarshaller; | ||
26 | use Symfony\Component\Cache\Marshaller\MarshallerInterface; | ||
27 | use Symfony\Component\Cache\PruneableInterface; | ||
28 | |||
29 | class DoctrineDbalAdapter extends AbstractAdapter implements PruneableInterface | ||
30 | { | ||
31 | private const MAX_KEY_LENGTH = 255; | ||
32 | |||
33 | private MarshallerInterface $marshaller; | ||
34 | private Connection $conn; | ||
35 | private string $platformName; | ||
36 | private string $table = 'cache_items'; | ||
37 | private string $idCol = 'item_id'; | ||
38 | private string $dataCol = 'item_data'; | ||
39 | private string $lifetimeCol = 'item_lifetime'; | ||
40 | private string $timeCol = 'item_time'; | ||
41 | |||
42 | /** | ||
43 | * You can either pass an existing database Doctrine DBAL Connection or | ||
44 | * a DSN string that will be used to connect to the database. | ||
45 | * | ||
46 | * The cache table is created automatically when possible. | ||
47 | * Otherwise, use the createTable() method. | ||
48 | * | ||
49 | * List of available options: | ||
50 | * * db_table: The name of the table [default: cache_items] | ||
51 | * * db_id_col: The column where to store the cache id [default: item_id] | ||
52 | * * db_data_col: The column where to store the cache data [default: item_data] | ||
53 | * * db_lifetime_col: The column where to store the lifetime [default: item_lifetime] | ||
54 | * * db_time_col: The column where to store the timestamp [default: item_time] | ||
55 | * | ||
56 | * @throws InvalidArgumentException When namespace contains invalid characters | ||
57 | */ | ||
58 | public function __construct( | ||
59 | Connection|string $connOrDsn, | ||
60 | private string $namespace = '', | ||
61 | int $defaultLifetime = 0, | ||
62 | array $options = [], | ||
63 | ?MarshallerInterface $marshaller = null, | ||
64 | ) { | ||
65 | if (isset($namespace[0]) && preg_match('#[^-+.A-Za-z0-9]#', $namespace, $match)) { | ||
66 | throw new InvalidArgumentException(sprintf('Namespace contains "%s" but only characters in [-+.A-Za-z0-9] are allowed.', $match[0])); | ||
67 | } | ||
68 | |||
69 | if ($connOrDsn instanceof Connection) { | ||
70 | $this->conn = $connOrDsn; | ||
71 | } else { | ||
72 | if (!class_exists(DriverManager::class)) { | ||
73 | throw new InvalidArgumentException('Failed to parse DSN. Try running "composer require doctrine/dbal".'); | ||
74 | } | ||
75 | $params = (new DsnParser([ | ||
76 | 'db2' => 'ibm_db2', | ||
77 | 'mssql' => 'pdo_sqlsrv', | ||
78 | 'mysql' => 'pdo_mysql', | ||
79 | 'mysql2' => 'pdo_mysql', | ||
80 | 'postgres' => 'pdo_pgsql', | ||
81 | 'postgresql' => 'pdo_pgsql', | ||
82 | 'pgsql' => 'pdo_pgsql', | ||
83 | 'sqlite' => 'pdo_sqlite', | ||
84 | 'sqlite3' => 'pdo_sqlite', | ||
85 | ]))->parse($connOrDsn); | ||
86 | |||
87 | $config = new Configuration(); | ||
88 | $config->setSchemaManagerFactory(new DefaultSchemaManagerFactory()); | ||
89 | |||
90 | $this->conn = DriverManager::getConnection($params, $config); | ||
91 | } | ||
92 | |||
93 | $this->maxIdLength = self::MAX_KEY_LENGTH; | ||
94 | $this->table = $options['db_table'] ?? $this->table; | ||
95 | $this->idCol = $options['db_id_col'] ?? $this->idCol; | ||
96 | $this->dataCol = $options['db_data_col'] ?? $this->dataCol; | ||
97 | $this->lifetimeCol = $options['db_lifetime_col'] ?? $this->lifetimeCol; | ||
98 | $this->timeCol = $options['db_time_col'] ?? $this->timeCol; | ||
99 | $this->marshaller = $marshaller ?? new DefaultMarshaller(); | ||
100 | |||
101 | parent::__construct($namespace, $defaultLifetime); | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * Creates the table to store cache items which can be called once for setup. | ||
106 | * | ||
107 | * Cache ID are saved in a column of maximum length 255. Cache data is | ||
108 | * saved in a BLOB. | ||
109 | * | ||
110 | * @throws DBALException When the table already exists | ||
111 | */ | ||
112 | public function createTable(): void | ||
113 | { | ||
114 | $schema = new Schema(); | ||
115 | $this->addTableToSchema($schema); | ||
116 | |||
117 | foreach ($schema->toSql($this->conn->getDatabasePlatform()) as $sql) { | ||
118 | $this->conn->executeStatement($sql); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | public function configureSchema(Schema $schema, Connection $forConnection, \Closure $isSameDatabase): void | ||
123 | { | ||
124 | if ($schema->hasTable($this->table)) { | ||
125 | return; | ||
126 | } | ||
127 | |||
128 | if ($forConnection !== $this->conn && !$isSameDatabase($this->conn->executeStatement(...))) { | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | $this->addTableToSchema($schema); | ||
133 | } | ||
134 | |||
135 | public function prune(): bool | ||
136 | { | ||
137 | $deleteSql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol <= ?"; | ||
138 | $params = [time()]; | ||
139 | $paramTypes = [ParameterType::INTEGER]; | ||
140 | |||
141 | if ('' !== $this->namespace) { | ||
142 | $deleteSql .= " AND $this->idCol LIKE ?"; | ||
143 | $params[] = sprintf('%s%%', $this->namespace); | ||
144 | $paramTypes[] = ParameterType::STRING; | ||
145 | } | ||
146 | |||
147 | try { | ||
148 | $this->conn->executeStatement($deleteSql, $params, $paramTypes); | ||
149 | } catch (TableNotFoundException) { | ||
150 | } | ||
151 | |||
152 | return true; | ||
153 | } | ||
154 | |||
155 | protected function doFetch(array $ids): iterable | ||
156 | { | ||
157 | $now = time(); | ||
158 | $expired = []; | ||
159 | |||
160 | $sql = "SELECT $this->idCol, CASE WHEN $this->lifetimeCol IS NULL OR $this->lifetimeCol + $this->timeCol > ? THEN $this->dataCol ELSE NULL END FROM $this->table WHERE $this->idCol IN (?)"; | ||
161 | $result = $this->conn->executeQuery($sql, [ | ||
162 | $now, | ||
163 | $ids, | ||
164 | ], [ | ||
165 | ParameterType::INTEGER, | ||
166 | ArrayParameterType::STRING, | ||
167 | ])->iterateNumeric(); | ||
168 | |||
169 | foreach ($result as $row) { | ||
170 | if (null === $row[1]) { | ||
171 | $expired[] = $row[0]; | ||
172 | } else { | ||
173 | yield $row[0] => $this->marshaller->unmarshall(\is_resource($row[1]) ? stream_get_contents($row[1]) : $row[1]); | ||
174 | } | ||
175 | } | ||
176 | |||
177 | if ($expired) { | ||
178 | $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol <= ? AND $this->idCol IN (?)"; | ||
179 | $this->conn->executeStatement($sql, [ | ||
180 | $now, | ||
181 | $expired, | ||
182 | ], [ | ||
183 | ParameterType::INTEGER, | ||
184 | ArrayParameterType::STRING, | ||
185 | ]); | ||
186 | } | ||
187 | } | ||
188 | |||
189 | protected function doHave(string $id): bool | ||
190 | { | ||
191 | $sql = "SELECT 1 FROM $this->table WHERE $this->idCol = ? AND ($this->lifetimeCol IS NULL OR $this->lifetimeCol + $this->timeCol > ?)"; | ||
192 | $result = $this->conn->executeQuery($sql, [ | ||
193 | $id, | ||
194 | time(), | ||
195 | ], [ | ||
196 | ParameterType::STRING, | ||
197 | ParameterType::INTEGER, | ||
198 | ]); | ||
199 | |||
200 | return (bool) $result->fetchOne(); | ||
201 | } | ||
202 | |||
203 | protected function doClear(string $namespace): bool | ||
204 | { | ||
205 | if ('' === $namespace) { | ||
206 | $sql = $this->conn->getDatabasePlatform()->getTruncateTableSQL($this->table); | ||
207 | } else { | ||
208 | $sql = "DELETE FROM $this->table WHERE $this->idCol LIKE '$namespace%'"; | ||
209 | } | ||
210 | |||
211 | try { | ||
212 | $this->conn->executeStatement($sql); | ||
213 | } catch (TableNotFoundException) { | ||
214 | } | ||
215 | |||
216 | return true; | ||
217 | } | ||
218 | |||
219 | protected function doDelete(array $ids): bool | ||
220 | { | ||
221 | $sql = "DELETE FROM $this->table WHERE $this->idCol IN (?)"; | ||
222 | try { | ||
223 | $this->conn->executeStatement($sql, [array_values($ids)], [ArrayParameterType::STRING]); | ||
224 | } catch (TableNotFoundException) { | ||
225 | } | ||
226 | |||
227 | return true; | ||
228 | } | ||
229 | |||
230 | protected function doSave(array $values, int $lifetime): array|bool | ||
231 | { | ||
232 | if (!$values = $this->marshaller->marshall($values, $failed)) { | ||
233 | return $failed; | ||
234 | } | ||
235 | |||
236 | $platformName = $this->getPlatformName(); | ||
237 | $insertSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?)"; | ||
238 | |||
239 | switch ($platformName) { | ||
240 | case 'mysql': | ||
241 | $sql = $insertSql." ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->lifetimeCol = VALUES($this->lifetimeCol), $this->timeCol = VALUES($this->timeCol)"; | ||
242 | break; | ||
243 | case 'oci': | ||
244 | // DUAL is Oracle specific dummy table | ||
245 | $sql = "MERGE INTO $this->table USING DUAL ON ($this->idCol = ?) ". | ||
246 | "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ". | ||
247 | "WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?"; | ||
248 | break; | ||
249 | case 'sqlsrv': | ||
250 | // MERGE is only available since SQL Server 2008 and must be terminated by semicolon | ||
251 | // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx | ||
252 | $sql = "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = ?) ". | ||
253 | "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ". | ||
254 | "WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?;"; | ||
255 | break; | ||
256 | case 'sqlite': | ||
257 | $sql = 'INSERT OR REPLACE'.substr($insertSql, 6); | ||
258 | break; | ||
259 | case 'pgsql': | ||
260 | $sql = $insertSql." ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->lifetimeCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->lifetimeCol, EXCLUDED.$this->timeCol)"; | ||
261 | break; | ||
262 | default: | ||
263 | $platformName = null; | ||
264 | $sql = "UPDATE $this->table SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ? WHERE $this->idCol = ?"; | ||
265 | break; | ||
266 | } | ||
267 | |||
268 | $now = time(); | ||
269 | $lifetime = $lifetime ?: null; | ||
270 | try { | ||
271 | $stmt = $this->conn->prepare($sql); | ||
272 | } catch (TableNotFoundException) { | ||
273 | if (!$this->conn->isTransactionActive() || \in_array($platformName, ['pgsql', 'sqlite', 'sqlsrv'], true)) { | ||
274 | $this->createTable(); | ||
275 | } | ||
276 | $stmt = $this->conn->prepare($sql); | ||
277 | } | ||
278 | |||
279 | if ('sqlsrv' === $platformName || 'oci' === $platformName) { | ||
280 | $bind = static function ($id, $data) use ($stmt) { | ||
281 | $stmt->bindValue(1, $id); | ||
282 | $stmt->bindValue(2, $id); | ||
283 | $stmt->bindValue(3, $data, ParameterType::LARGE_OBJECT); | ||
284 | $stmt->bindValue(6, $data, ParameterType::LARGE_OBJECT); | ||
285 | }; | ||
286 | $stmt->bindValue(4, $lifetime, ParameterType::INTEGER); | ||
287 | $stmt->bindValue(5, $now, ParameterType::INTEGER); | ||
288 | $stmt->bindValue(7, $lifetime, ParameterType::INTEGER); | ||
289 | $stmt->bindValue(8, $now, ParameterType::INTEGER); | ||
290 | } elseif (null !== $platformName) { | ||
291 | $bind = static function ($id, $data) use ($stmt) { | ||
292 | $stmt->bindValue(1, $id); | ||
293 | $stmt->bindValue(2, $data, ParameterType::LARGE_OBJECT); | ||
294 | }; | ||
295 | $stmt->bindValue(3, $lifetime, ParameterType::INTEGER); | ||
296 | $stmt->bindValue(4, $now, ParameterType::INTEGER); | ||
297 | } else { | ||
298 | $stmt->bindValue(2, $lifetime, ParameterType::INTEGER); | ||
299 | $stmt->bindValue(3, $now, ParameterType::INTEGER); | ||
300 | |||
301 | $insertStmt = $this->conn->prepare($insertSql); | ||
302 | $insertStmt->bindValue(3, $lifetime, ParameterType::INTEGER); | ||
303 | $insertStmt->bindValue(4, $now, ParameterType::INTEGER); | ||
304 | |||
305 | $bind = static function ($id, $data) use ($stmt, $insertStmt) { | ||
306 | $stmt->bindValue(1, $data, ParameterType::LARGE_OBJECT); | ||
307 | $stmt->bindValue(4, $id); | ||
308 | $insertStmt->bindValue(1, $id); | ||
309 | $insertStmt->bindValue(2, $data, ParameterType::LARGE_OBJECT); | ||
310 | }; | ||
311 | } | ||
312 | |||
313 | foreach ($values as $id => $data) { | ||
314 | $bind($id, $data); | ||
315 | try { | ||
316 | $rowCount = $stmt->executeStatement(); | ||
317 | } catch (TableNotFoundException) { | ||
318 | if (!$this->conn->isTransactionActive() || \in_array($platformName, ['pgsql', 'sqlite', 'sqlsrv'], true)) { | ||
319 | $this->createTable(); | ||
320 | } | ||
321 | $rowCount = $stmt->executeStatement(); | ||
322 | } | ||
323 | if (null === $platformName && 0 === $rowCount) { | ||
324 | try { | ||
325 | $insertStmt->executeStatement(); | ||
326 | } catch (DBALException) { | ||
327 | // A concurrent write won, let it be | ||
328 | } | ||
329 | } | ||
330 | } | ||
331 | |||
332 | return $failed; | ||
333 | } | ||
334 | |||
335 | /** | ||
336 | * @internal | ||
337 | */ | ||
338 | protected function getId(mixed $key): string | ||
339 | { | ||
340 | if ('pgsql' !== $this->platformName ??= $this->getPlatformName()) { | ||
341 | return parent::getId($key); | ||
342 | } | ||
343 | |||
344 | if (str_contains($key, "\0") || str_contains($key, '%') || !preg_match('//u', $key)) { | ||
345 | $key = rawurlencode($key); | ||
346 | } | ||
347 | |||
348 | return parent::getId($key); | ||
349 | } | ||
350 | |||
351 | private function getPlatformName(): string | ||
352 | { | ||
353 | if (isset($this->platformName)) { | ||
354 | return $this->platformName; | ||
355 | } | ||
356 | |||
357 | $platform = $this->conn->getDatabasePlatform(); | ||
358 | |||
359 | return $this->platformName = match (true) { | ||
360 | $platform instanceof \Doctrine\DBAL\Platforms\AbstractMySQLPlatform => 'mysql', | ||
361 | $platform instanceof \Doctrine\DBAL\Platforms\SqlitePlatform => 'sqlite', | ||
362 | $platform instanceof \Doctrine\DBAL\Platforms\PostgreSQLPlatform => 'pgsql', | ||
363 | $platform instanceof \Doctrine\DBAL\Platforms\OraclePlatform => 'oci', | ||
364 | $platform instanceof \Doctrine\DBAL\Platforms\SQLServerPlatform => 'sqlsrv', | ||
365 | default => $platform::class, | ||
366 | }; | ||
367 | } | ||
368 | |||
369 | private function addTableToSchema(Schema $schema): void | ||
370 | { | ||
371 | $types = [ | ||
372 | 'mysql' => 'binary', | ||
373 | 'sqlite' => 'text', | ||
374 | ]; | ||
375 | |||
376 | $table = $schema->createTable($this->table); | ||
377 | $table->addColumn($this->idCol, $types[$this->getPlatformName()] ?? 'string', ['length' => 255]); | ||
378 | $table->addColumn($this->dataCol, 'blob', ['length' => 16777215]); | ||
379 | $table->addColumn($this->lifetimeCol, 'integer', ['unsigned' => true, 'notnull' => false]); | ||
380 | $table->addColumn($this->timeCol, 'integer', ['unsigned' => true]); | ||
381 | $table->setPrimaryKey([$this->idCol]); | ||
382 | } | ||
383 | } | ||
diff --git a/vendor/symfony/cache/Adapter/FilesystemAdapter.php b/vendor/symfony/cache/Adapter/FilesystemAdapter.php new file mode 100644 index 0000000..13daa56 --- /dev/null +++ b/vendor/symfony/cache/Adapter/FilesystemAdapter.php | |||
@@ -0,0 +1,29 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Symfony\Component\Cache\Marshaller\DefaultMarshaller; | ||
15 | use Symfony\Component\Cache\Marshaller\MarshallerInterface; | ||
16 | use Symfony\Component\Cache\PruneableInterface; | ||
17 | use Symfony\Component\Cache\Traits\FilesystemTrait; | ||
18 | |||
19 | class FilesystemAdapter extends AbstractAdapter implements PruneableInterface | ||
20 | { | ||
21 | use FilesystemTrait; | ||
22 | |||
23 | public function __construct(string $namespace = '', int $defaultLifetime = 0, ?string $directory = null, ?MarshallerInterface $marshaller = null) | ||
24 | { | ||
25 | $this->marshaller = $marshaller ?? new DefaultMarshaller(); | ||
26 | parent::__construct('', $defaultLifetime); | ||
27 | $this->init($namespace, $directory); | ||
28 | } | ||
29 | } | ||
diff --git a/vendor/symfony/cache/Adapter/FilesystemTagAwareAdapter.php b/vendor/symfony/cache/Adapter/FilesystemTagAwareAdapter.php new file mode 100644 index 0000000..80edee4 --- /dev/null +++ b/vendor/symfony/cache/Adapter/FilesystemTagAwareAdapter.php | |||
@@ -0,0 +1,267 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Symfony\Component\Cache\Marshaller\MarshallerInterface; | ||
15 | use Symfony\Component\Cache\Marshaller\TagAwareMarshaller; | ||
16 | use Symfony\Component\Cache\PruneableInterface; | ||
17 | use Symfony\Component\Cache\Traits\FilesystemTrait; | ||
18 | |||
19 | /** | ||
20 | * Stores tag id <> cache id relationship as a symlink, and lookup on invalidation calls. | ||
21 | * | ||
22 | * @author Nicolas Grekas <p@tchwork.com> | ||
23 | * @author André Rømcke <andre.romcke+symfony@gmail.com> | ||
24 | */ | ||
25 | class FilesystemTagAwareAdapter extends AbstractTagAwareAdapter implements PruneableInterface | ||
26 | { | ||
27 | use FilesystemTrait { | ||
28 | prune as private doPrune; | ||
29 | doClear as private doClearCache; | ||
30 | doSave as private doSaveCache; | ||
31 | } | ||
32 | |||
33 | /** | ||
34 | * Folder used for tag symlinks. | ||
35 | */ | ||
36 | private const TAG_FOLDER = 'tags'; | ||
37 | |||
38 | public function __construct(string $namespace = '', int $defaultLifetime = 0, ?string $directory = null, ?MarshallerInterface $marshaller = null) | ||
39 | { | ||
40 | $this->marshaller = new TagAwareMarshaller($marshaller); | ||
41 | parent::__construct('', $defaultLifetime); | ||
42 | $this->init($namespace, $directory); | ||
43 | } | ||
44 | |||
45 | public function prune(): bool | ||
46 | { | ||
47 | $ok = $this->doPrune(); | ||
48 | |||
49 | set_error_handler(static function () {}); | ||
50 | $chars = '+-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; | ||
51 | |||
52 | try { | ||
53 | foreach ($this->scanHashDir($this->directory.self::TAG_FOLDER.\DIRECTORY_SEPARATOR) as $dir) { | ||
54 | $dir .= \DIRECTORY_SEPARATOR; | ||
55 | $keepDir = false; | ||
56 | for ($i = 0; $i < 38; ++$i) { | ||
57 | if (!is_dir($dir.$chars[$i])) { | ||
58 | continue; | ||
59 | } | ||
60 | for ($j = 0; $j < 38; ++$j) { | ||
61 | if (!is_dir($d = $dir.$chars[$i].\DIRECTORY_SEPARATOR.$chars[$j])) { | ||
62 | continue; | ||
63 | } | ||
64 | foreach (scandir($d, \SCANDIR_SORT_NONE) ?: [] as $link) { | ||
65 | if ('.' === $link || '..' === $link) { | ||
66 | continue; | ||
67 | } | ||
68 | if ('_' !== $dir[-2] && realpath($d.\DIRECTORY_SEPARATOR.$link)) { | ||
69 | $keepDir = true; | ||
70 | } else { | ||
71 | unlink($d.\DIRECTORY_SEPARATOR.$link); | ||
72 | } | ||
73 | } | ||
74 | $keepDir ?: rmdir($d); | ||
75 | } | ||
76 | $keepDir ?: rmdir($dir.$chars[$i]); | ||
77 | } | ||
78 | $keepDir ?: rmdir($dir); | ||
79 | } | ||
80 | } finally { | ||
81 | restore_error_handler(); | ||
82 | } | ||
83 | |||
84 | return $ok; | ||
85 | } | ||
86 | |||
87 | protected function doClear(string $namespace): bool | ||
88 | { | ||
89 | $ok = $this->doClearCache($namespace); | ||
90 | |||
91 | if ('' !== $namespace) { | ||
92 | return $ok; | ||
93 | } | ||
94 | |||
95 | set_error_handler(static function () {}); | ||
96 | $chars = '+-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; | ||
97 | |||
98 | $this->tmpSuffix ??= str_replace('/', '-', base64_encode(random_bytes(6))); | ||
99 | |||
100 | try { | ||
101 | foreach ($this->scanHashDir($this->directory.self::TAG_FOLDER.\DIRECTORY_SEPARATOR) as $dir) { | ||
102 | if (rename($dir, $renamed = substr_replace($dir, $this->tmpSuffix.'_', -9))) { | ||
103 | $dir = $renamed.\DIRECTORY_SEPARATOR; | ||
104 | } else { | ||
105 | $dir .= \DIRECTORY_SEPARATOR; | ||
106 | $renamed = null; | ||
107 | } | ||
108 | |||
109 | for ($i = 0; $i < 38; ++$i) { | ||
110 | if (!is_dir($dir.$chars[$i])) { | ||
111 | continue; | ||
112 | } | ||
113 | for ($j = 0; $j < 38; ++$j) { | ||
114 | if (!is_dir($d = $dir.$chars[$i].\DIRECTORY_SEPARATOR.$chars[$j])) { | ||
115 | continue; | ||
116 | } | ||
117 | foreach (scandir($d, \SCANDIR_SORT_NONE) ?: [] as $link) { | ||
118 | if ('.' !== $link && '..' !== $link && (null !== $renamed || !realpath($d.\DIRECTORY_SEPARATOR.$link))) { | ||
119 | unlink($d.\DIRECTORY_SEPARATOR.$link); | ||
120 | } | ||
121 | } | ||
122 | null === $renamed ?: rmdir($d); | ||
123 | } | ||
124 | null === $renamed ?: rmdir($dir.$chars[$i]); | ||
125 | } | ||
126 | null === $renamed ?: rmdir($renamed); | ||
127 | } | ||
128 | } finally { | ||
129 | restore_error_handler(); | ||
130 | } | ||
131 | |||
132 | return $ok; | ||
133 | } | ||
134 | |||
135 | protected function doSave(array $values, int $lifetime, array $addTagData = [], array $removeTagData = []): array | ||
136 | { | ||
137 | $failed = $this->doSaveCache($values, $lifetime); | ||
138 | |||
139 | // Add Tags as symlinks | ||
140 | foreach ($addTagData as $tagId => $ids) { | ||
141 | $tagFolder = $this->getTagFolder($tagId); | ||
142 | foreach ($ids as $id) { | ||
143 | if ($failed && \in_array($id, $failed, true)) { | ||
144 | continue; | ||
145 | } | ||
146 | |||
147 | $file = $this->getFile($id); | ||
148 | |||
149 | if (!@symlink($file, $tagLink = $this->getFile($id, true, $tagFolder)) && !is_link($tagLink)) { | ||
150 | @unlink($file); | ||
151 | $failed[] = $id; | ||
152 | } | ||
153 | } | ||
154 | } | ||
155 | |||
156 | // Unlink removed Tags | ||
157 | foreach ($removeTagData as $tagId => $ids) { | ||
158 | $tagFolder = $this->getTagFolder($tagId); | ||
159 | foreach ($ids as $id) { | ||
160 | if ($failed && \in_array($id, $failed, true)) { | ||
161 | continue; | ||
162 | } | ||
163 | |||
164 | @unlink($this->getFile($id, false, $tagFolder)); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | return $failed; | ||
169 | } | ||
170 | |||
171 | protected function doDeleteYieldTags(array $ids): iterable | ||
172 | { | ||
173 | foreach ($ids as $id) { | ||
174 | $file = $this->getFile($id); | ||
175 | if (!is_file($file) || !$h = @fopen($file, 'r')) { | ||
176 | continue; | ||
177 | } | ||
178 | |||
179 | if (!@unlink($file)) { | ||
180 | fclose($h); | ||
181 | continue; | ||
182 | } | ||
183 | |||
184 | $meta = explode("\n", fread($h, 4096), 3)[2] ?? ''; | ||
185 | |||
186 | // detect the compact format used in marshall() using magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F | ||
187 | if (13 < \strlen($meta) && "\x9D" === $meta[0] && "\0" === $meta[5] && "\x5F" === $meta[9]) { | ||
188 | $meta[9] = "\0"; | ||
189 | $tagLen = unpack('Nlen', $meta, 9)['len']; | ||
190 | $meta = substr($meta, 13, $tagLen); | ||
191 | |||
192 | if (0 < $tagLen -= \strlen($meta)) { | ||
193 | $meta .= fread($h, $tagLen); | ||
194 | } | ||
195 | |||
196 | try { | ||
197 | yield $id => '' === $meta ? [] : $this->marshaller->unmarshall($meta); | ||
198 | } catch (\Exception) { | ||
199 | yield $id => []; | ||
200 | } | ||
201 | } | ||
202 | |||
203 | fclose($h); | ||
204 | } | ||
205 | } | ||
206 | |||
207 | protected function doDeleteTagRelations(array $tagData): bool | ||
208 | { | ||
209 | foreach ($tagData as $tagId => $idList) { | ||
210 | $tagFolder = $this->getTagFolder($tagId); | ||
211 | foreach ($idList as $id) { | ||
212 | @unlink($this->getFile($id, false, $tagFolder)); | ||
213 | } | ||
214 | } | ||
215 | |||
216 | return true; | ||
217 | } | ||
218 | |||
219 | protected function doInvalidate(array $tagIds): bool | ||
220 | { | ||
221 | foreach ($tagIds as $tagId) { | ||
222 | if (!is_dir($tagFolder = $this->getTagFolder($tagId))) { | ||
223 | continue; | ||
224 | } | ||
225 | |||
226 | $this->tmpSuffix ??= str_replace('/', '-', base64_encode(random_bytes(6))); | ||
227 | |||
228 | set_error_handler(static function () {}); | ||
229 | |||
230 | try { | ||
231 | if (rename($tagFolder, $renamed = substr_replace($tagFolder, $this->tmpSuffix.'_', -10))) { | ||
232 | $tagFolder = $renamed.\DIRECTORY_SEPARATOR; | ||
233 | } else { | ||
234 | $renamed = null; | ||
235 | } | ||
236 | |||
237 | foreach ($this->scanHashDir($tagFolder) as $itemLink) { | ||
238 | unlink(realpath($itemLink) ?: $itemLink); | ||
239 | unlink($itemLink); | ||
240 | } | ||
241 | |||
242 | if (null === $renamed) { | ||
243 | continue; | ||
244 | } | ||
245 | |||
246 | $chars = '+-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; | ||
247 | |||
248 | for ($i = 0; $i < 38; ++$i) { | ||
249 | for ($j = 0; $j < 38; ++$j) { | ||
250 | rmdir($tagFolder.$chars[$i].\DIRECTORY_SEPARATOR.$chars[$j]); | ||
251 | } | ||
252 | rmdir($tagFolder.$chars[$i]); | ||
253 | } | ||
254 | rmdir($renamed); | ||
255 | } finally { | ||
256 | restore_error_handler(); | ||
257 | } | ||
258 | } | ||
259 | |||
260 | return true; | ||
261 | } | ||
262 | |||
263 | private function getTagFolder(string $tagId): string | ||
264 | { | ||
265 | return $this->getFile($tagId, false, $this->directory.self::TAG_FOLDER.\DIRECTORY_SEPARATOR).\DIRECTORY_SEPARATOR; | ||
266 | } | ||
267 | } | ||
diff --git a/vendor/symfony/cache/Adapter/MemcachedAdapter.php b/vendor/symfony/cache/Adapter/MemcachedAdapter.php new file mode 100644 index 0000000..033d987 --- /dev/null +++ b/vendor/symfony/cache/Adapter/MemcachedAdapter.php | |||
@@ -0,0 +1,329 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Symfony\Component\Cache\Exception\CacheException; | ||
15 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
16 | use Symfony\Component\Cache\Marshaller\DefaultMarshaller; | ||
17 | use Symfony\Component\Cache\Marshaller\MarshallerInterface; | ||
18 | |||
19 | /** | ||
20 | * @author Rob Frawley 2nd <rmf@src.run> | ||
21 | * @author Nicolas Grekas <p@tchwork.com> | ||
22 | */ | ||
23 | class MemcachedAdapter extends AbstractAdapter | ||
24 | { | ||
25 | /** | ||
26 | * We are replacing characters that are illegal in Memcached keys with reserved characters from | ||
27 | * {@see \Symfony\Contracts\Cache\ItemInterface::RESERVED_CHARACTERS} that are legal in Memcached. | ||
28 | * Note: don’t use {@see AbstractAdapter::NS_SEPARATOR}. | ||
29 | */ | ||
30 | private const RESERVED_MEMCACHED = " \n\r\t\v\f\0"; | ||
31 | private const RESERVED_PSR6 = '@()\{}/'; | ||
32 | private const MAX_KEY_LENGTH = 250; | ||
33 | |||
34 | private MarshallerInterface $marshaller; | ||
35 | private \Memcached $client; | ||
36 | private \Memcached $lazyClient; | ||
37 | |||
38 | /** | ||
39 | * Using a MemcachedAdapter with a TagAwareAdapter for storing tags is discouraged. | ||
40 | * Using a RedisAdapter is recommended instead. If you cannot do otherwise, be aware that: | ||
41 | * - the Memcached::OPT_BINARY_PROTOCOL must be enabled | ||
42 | * (that's the default when using MemcachedAdapter::createConnection()); | ||
43 | * - tags eviction by Memcached's LRU algorithm will break by-tags invalidation; | ||
44 | * your Memcached memory should be large enough to never trigger LRU. | ||
45 | * | ||
46 | * Using a MemcachedAdapter as a pure items store is fine. | ||
47 | */ | ||
48 | public function __construct(\Memcached $client, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null) | ||
49 | { | ||
50 | if (!static::isSupported()) { | ||
51 | throw new CacheException('Memcached > 3.1.5 is required.'); | ||
52 | } | ||
53 | $this->maxIdLength = self::MAX_KEY_LENGTH; | ||
54 | |||
55 | if ('Memcached' === $client::class) { | ||
56 | $opt = $client->getOption(\Memcached::OPT_SERIALIZER); | ||
57 | if (\Memcached::SERIALIZER_PHP !== $opt && \Memcached::SERIALIZER_IGBINARY !== $opt) { | ||
58 | throw new CacheException('MemcachedAdapter: "serializer" option must be "php" or "igbinary".'); | ||
59 | } | ||
60 | $this->maxIdLength -= \strlen($client->getOption(\Memcached::OPT_PREFIX_KEY)); | ||
61 | $this->client = $client; | ||
62 | } else { | ||
63 | $this->lazyClient = $client; | ||
64 | } | ||
65 | |||
66 | parent::__construct($namespace, $defaultLifetime); | ||
67 | $this->enableVersioning(); | ||
68 | $this->marshaller = $marshaller ?? new DefaultMarshaller(); | ||
69 | } | ||
70 | |||
71 | public static function isSupported(): bool | ||
72 | { | ||
73 | return \extension_loaded('memcached') && version_compare(phpversion('memcached'), '3.1.6', '>='); | ||
74 | } | ||
75 | |||
76 | /** | ||
77 | * Creates a Memcached instance. | ||
78 | * | ||
79 | * By default, the binary protocol, no block, and libketama compatible options are enabled. | ||
80 | * | ||
81 | * Examples for servers: | ||
82 | * - 'memcached://user:pass@localhost?weight=33' | ||
83 | * - [['localhost', 11211, 33]] | ||
84 | * | ||
85 | * @param array[]|string|string[] $servers An array of servers, a DSN, or an array of DSNs | ||
86 | * | ||
87 | * @throws \ErrorException When invalid options or servers are provided | ||
88 | */ | ||
89 | public static function createConnection(#[\SensitiveParameter] array|string $servers, array $options = []): \Memcached | ||
90 | { | ||
91 | if (\is_string($servers)) { | ||
92 | $servers = [$servers]; | ||
93 | } | ||
94 | if (!static::isSupported()) { | ||
95 | throw new CacheException('Memcached > 3.1.5 is required.'); | ||
96 | } | ||
97 | set_error_handler(static fn ($type, $msg, $file, $line) => throw new \ErrorException($msg, 0, $type, $file, $line)); | ||
98 | try { | ||
99 | $client = new \Memcached($options['persistent_id'] ?? null); | ||
100 | $username = $options['username'] ?? null; | ||
101 | $password = $options['password'] ?? null; | ||
102 | |||
103 | // parse any DSN in $servers | ||
104 | foreach ($servers as $i => $dsn) { | ||
105 | if (\is_array($dsn)) { | ||
106 | continue; | ||
107 | } | ||
108 | if (!str_starts_with($dsn, 'memcached:')) { | ||
109 | throw new InvalidArgumentException('Invalid Memcached DSN: it does not start with "memcached:".'); | ||
110 | } | ||
111 | $params = preg_replace_callback('#^memcached:(//)?(?:([^@]*+)@)?#', function ($m) use (&$username, &$password) { | ||
112 | if (!empty($m[2])) { | ||
113 | [$username, $password] = explode(':', $m[2], 2) + [1 => null]; | ||
114 | $username = rawurldecode($username); | ||
115 | $password = null !== $password ? rawurldecode($password) : null; | ||
116 | } | ||
117 | |||
118 | return 'file:'.($m[1] ?? ''); | ||
119 | }, $dsn); | ||
120 | if (false === $params = parse_url($params)) { | ||
121 | throw new InvalidArgumentException('Invalid Memcached DSN.'); | ||
122 | } | ||
123 | $query = $hosts = []; | ||
124 | if (isset($params['query'])) { | ||
125 | parse_str($params['query'], $query); | ||
126 | |||
127 | if (isset($query['host'])) { | ||
128 | if (!\is_array($hosts = $query['host'])) { | ||
129 | throw new InvalidArgumentException('Invalid Memcached DSN: query parameter "host" must be an array.'); | ||
130 | } | ||
131 | foreach ($hosts as $host => $weight) { | ||
132 | if (false === $port = strrpos($host, ':')) { | ||
133 | $hosts[$host] = [$host, 11211, (int) $weight]; | ||
134 | } else { | ||
135 | $hosts[$host] = [substr($host, 0, $port), (int) substr($host, 1 + $port), (int) $weight]; | ||
136 | } | ||
137 | } | ||
138 | $hosts = array_values($hosts); | ||
139 | unset($query['host']); | ||
140 | } | ||
141 | if ($hosts && !isset($params['host']) && !isset($params['path'])) { | ||
142 | unset($servers[$i]); | ||
143 | $servers = array_merge($servers, $hosts); | ||
144 | continue; | ||
145 | } | ||
146 | } | ||
147 | if (!isset($params['host']) && !isset($params['path'])) { | ||
148 | throw new InvalidArgumentException('Invalid Memcached DSN: missing host or path.'); | ||
149 | } | ||
150 | if (isset($params['path']) && preg_match('#/(\d+)$#', $params['path'], $m)) { | ||
151 | $params['weight'] = $m[1]; | ||
152 | $params['path'] = substr($params['path'], 0, -\strlen($m[0])); | ||
153 | } | ||
154 | $params += [ | ||
155 | 'host' => $params['host'] ?? $params['path'], | ||
156 | 'port' => isset($params['host']) ? 11211 : null, | ||
157 | 'weight' => 0, | ||
158 | ]; | ||
159 | if ($query) { | ||
160 | $params += $query; | ||
161 | $options = $query + $options; | ||
162 | } | ||
163 | |||
164 | $servers[$i] = [$params['host'], $params['port'], $params['weight']]; | ||
165 | |||
166 | if ($hosts) { | ||
167 | $servers = array_merge($servers, $hosts); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | // set client's options | ||
172 | unset($options['persistent_id'], $options['username'], $options['password'], $options['weight'], $options['lazy']); | ||
173 | $options = array_change_key_case($options, \CASE_UPPER); | ||
174 | $client->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); | ||
175 | $client->setOption(\Memcached::OPT_NO_BLOCK, true); | ||
176 | $client->setOption(\Memcached::OPT_TCP_NODELAY, true); | ||
177 | if (!\array_key_exists('LIBKETAMA_COMPATIBLE', $options) && !\array_key_exists(\Memcached::OPT_LIBKETAMA_COMPATIBLE, $options)) { | ||
178 | $client->setOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE, true); | ||
179 | } | ||
180 | foreach ($options as $name => $value) { | ||
181 | if (\is_int($name)) { | ||
182 | continue; | ||
183 | } | ||
184 | if ('HASH' === $name || 'SERIALIZER' === $name || 'DISTRIBUTION' === $name) { | ||
185 | $value = \constant('Memcached::'.$name.'_'.strtoupper($value)); | ||
186 | } | ||
187 | unset($options[$name]); | ||
188 | |||
189 | if (\defined('Memcached::OPT_'.$name)) { | ||
190 | $options[\constant('Memcached::OPT_'.$name)] = $value; | ||
191 | } | ||
192 | } | ||
193 | $client->setOptions($options + [\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_PHP]); | ||
194 | |||
195 | // set client's servers, taking care of persistent connections | ||
196 | if (!$client->isPristine()) { | ||
197 | $oldServers = []; | ||
198 | foreach ($client->getServerList() as $server) { | ||
199 | $oldServers[] = [$server['host'], $server['port']]; | ||
200 | } | ||
201 | |||
202 | $newServers = []; | ||
203 | foreach ($servers as $server) { | ||
204 | if (1 < \count($server)) { | ||
205 | $server = array_values($server); | ||
206 | unset($server[2]); | ||
207 | $server[1] = (int) $server[1]; | ||
208 | } | ||
209 | $newServers[] = $server; | ||
210 | } | ||
211 | |||
212 | if ($oldServers !== $newServers) { | ||
213 | $client->resetServerList(); | ||
214 | $client->addServers($servers); | ||
215 | } | ||
216 | } else { | ||
217 | $client->addServers($servers); | ||
218 | } | ||
219 | |||
220 | if (null !== $username || null !== $password) { | ||
221 | if (!method_exists($client, 'setSaslAuthData')) { | ||
222 | trigger_error('Missing SASL support: the memcached extension must be compiled with --enable-memcached-sasl.'); | ||
223 | } | ||
224 | $client->setSaslAuthData($username, $password); | ||
225 | } | ||
226 | |||
227 | return $client; | ||
228 | } finally { | ||
229 | restore_error_handler(); | ||
230 | } | ||
231 | } | ||
232 | |||
233 | protected function doSave(array $values, int $lifetime): array|bool | ||
234 | { | ||
235 | if (!$values = $this->marshaller->marshall($values, $failed)) { | ||
236 | return $failed; | ||
237 | } | ||
238 | |||
239 | if ($lifetime && $lifetime > 30 * 86400) { | ||
240 | $lifetime += time(); | ||
241 | } | ||
242 | |||
243 | $encodedValues = []; | ||
244 | foreach ($values as $key => $value) { | ||
245 | $encodedValues[self::encodeKey($key)] = $value; | ||
246 | } | ||
247 | |||
248 | return $this->checkResultCode($this->getClient()->setMulti($encodedValues, $lifetime)) ? $failed : false; | ||
249 | } | ||
250 | |||
251 | protected function doFetch(array $ids): iterable | ||
252 | { | ||
253 | try { | ||
254 | $encodedIds = array_map([__CLASS__, 'encodeKey'], $ids); | ||
255 | |||
256 | $encodedResult = $this->checkResultCode($this->getClient()->getMulti($encodedIds)); | ||
257 | |||
258 | $result = []; | ||
259 | foreach ($encodedResult as $key => $value) { | ||
260 | $result[self::decodeKey($key)] = $this->marshaller->unmarshall($value); | ||
261 | } | ||
262 | |||
263 | return $result; | ||
264 | } catch (\Error $e) { | ||
265 | throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); | ||
266 | } | ||
267 | } | ||
268 | |||
269 | protected function doHave(string $id): bool | ||
270 | { | ||
271 | return false !== $this->getClient()->get(self::encodeKey($id)) || $this->checkResultCode(\Memcached::RES_SUCCESS === $this->client->getResultCode()); | ||
272 | } | ||
273 | |||
274 | protected function doDelete(array $ids): bool | ||
275 | { | ||
276 | $ok = true; | ||
277 | $encodedIds = array_map([__CLASS__, 'encodeKey'], $ids); | ||
278 | foreach ($this->checkResultCode($this->getClient()->deleteMulti($encodedIds)) as $result) { | ||
279 | if (\Memcached::RES_SUCCESS !== $result && \Memcached::RES_NOTFOUND !== $result) { | ||
280 | $ok = false; | ||
281 | } | ||
282 | } | ||
283 | |||
284 | return $ok; | ||
285 | } | ||
286 | |||
287 | protected function doClear(string $namespace): bool | ||
288 | { | ||
289 | return '' === $namespace && $this->getClient()->flush(); | ||
290 | } | ||
291 | |||
292 | private function checkResultCode(mixed $result): mixed | ||
293 | { | ||
294 | $code = $this->client->getResultCode(); | ||
295 | |||
296 | if (\Memcached::RES_SUCCESS === $code || \Memcached::RES_NOTFOUND === $code) { | ||
297 | return $result; | ||
298 | } | ||
299 | |||
300 | throw new CacheException('MemcachedAdapter client error: '.strtolower($this->client->getResultMessage())); | ||
301 | } | ||
302 | |||
303 | private function getClient(): \Memcached | ||
304 | { | ||
305 | if (isset($this->client)) { | ||
306 | return $this->client; | ||
307 | } | ||
308 | |||
309 | $opt = $this->lazyClient->getOption(\Memcached::OPT_SERIALIZER); | ||
310 | if (\Memcached::SERIALIZER_PHP !== $opt && \Memcached::SERIALIZER_IGBINARY !== $opt) { | ||
311 | throw new CacheException('MemcachedAdapter: "serializer" option must be "php" or "igbinary".'); | ||
312 | } | ||
313 | if ('' !== $prefix = (string) $this->lazyClient->getOption(\Memcached::OPT_PREFIX_KEY)) { | ||
314 | throw new CacheException(sprintf('MemcachedAdapter: "prefix_key" option must be empty when using proxified connections, "%s" given.', $prefix)); | ||
315 | } | ||
316 | |||
317 | return $this->client = $this->lazyClient; | ||
318 | } | ||
319 | |||
320 | private static function encodeKey(string $key): string | ||
321 | { | ||
322 | return strtr($key, self::RESERVED_MEMCACHED, self::RESERVED_PSR6); | ||
323 | } | ||
324 | |||
325 | private static function decodeKey(string $key): string | ||
326 | { | ||
327 | return strtr($key, self::RESERVED_PSR6, self::RESERVED_MEMCACHED); | ||
328 | } | ||
329 | } | ||
diff --git a/vendor/symfony/cache/Adapter/NullAdapter.php b/vendor/symfony/cache/Adapter/NullAdapter.php new file mode 100644 index 0000000..d5d2ef6 --- /dev/null +++ b/vendor/symfony/cache/Adapter/NullAdapter.php | |||
@@ -0,0 +1,105 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Psr\Cache\CacheItemInterface; | ||
15 | use Symfony\Component\Cache\CacheItem; | ||
16 | use Symfony\Contracts\Cache\CacheInterface; | ||
17 | |||
18 | /** | ||
19 | * @author Titouan Galopin <galopintitouan@gmail.com> | ||
20 | */ | ||
21 | class NullAdapter implements AdapterInterface, CacheInterface | ||
22 | { | ||
23 | private static \Closure $createCacheItem; | ||
24 | |||
25 | public function __construct() | ||
26 | { | ||
27 | self::$createCacheItem ??= \Closure::bind( | ||
28 | static function ($key) { | ||
29 | $item = new CacheItem(); | ||
30 | $item->key = $key; | ||
31 | $item->isHit = false; | ||
32 | |||
33 | return $item; | ||
34 | }, | ||
35 | null, | ||
36 | CacheItem::class | ||
37 | ); | ||
38 | } | ||
39 | |||
40 | public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed | ||
41 | { | ||
42 | $save = true; | ||
43 | |||
44 | return $callback((self::$createCacheItem)($key), $save); | ||
45 | } | ||
46 | |||
47 | public function getItem(mixed $key): CacheItem | ||
48 | { | ||
49 | return (self::$createCacheItem)($key); | ||
50 | } | ||
51 | |||
52 | public function getItems(array $keys = []): iterable | ||
53 | { | ||
54 | return $this->generateItems($keys); | ||
55 | } | ||
56 | |||
57 | public function hasItem(mixed $key): bool | ||
58 | { | ||
59 | return false; | ||
60 | } | ||
61 | |||
62 | public function clear(string $prefix = ''): bool | ||
63 | { | ||
64 | return true; | ||
65 | } | ||
66 | |||
67 | public function deleteItem(mixed $key): bool | ||
68 | { | ||
69 | return true; | ||
70 | } | ||
71 | |||
72 | public function deleteItems(array $keys): bool | ||
73 | { | ||
74 | return true; | ||
75 | } | ||
76 | |||
77 | public function save(CacheItemInterface $item): bool | ||
78 | { | ||
79 | return true; | ||
80 | } | ||
81 | |||
82 | public function saveDeferred(CacheItemInterface $item): bool | ||
83 | { | ||
84 | return true; | ||
85 | } | ||
86 | |||
87 | public function commit(): bool | ||
88 | { | ||
89 | return true; | ||
90 | } | ||
91 | |||
92 | public function delete(string $key): bool | ||
93 | { | ||
94 | return $this->deleteItem($key); | ||
95 | } | ||
96 | |||
97 | private function generateItems(array $keys): \Generator | ||
98 | { | ||
99 | $f = self::$createCacheItem; | ||
100 | |||
101 | foreach ($keys as $key) { | ||
102 | yield $key => $f($key); | ||
103 | } | ||
104 | } | ||
105 | } | ||
diff --git a/vendor/symfony/cache/Adapter/ParameterNormalizer.php b/vendor/symfony/cache/Adapter/ParameterNormalizer.php new file mode 100644 index 0000000..a689640 --- /dev/null +++ b/vendor/symfony/cache/Adapter/ParameterNormalizer.php | |||
@@ -0,0 +1,35 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | /** | ||
15 | * @author Lars Strojny <lars@strojny.net> | ||
16 | */ | ||
17 | final class ParameterNormalizer | ||
18 | { | ||
19 | public static function normalizeDuration(string $duration): int | ||
20 | { | ||
21 | if (is_numeric($duration)) { | ||
22 | return $duration; | ||
23 | } | ||
24 | |||
25 | if (false !== $time = strtotime($duration, 0)) { | ||
26 | return $time; | ||
27 | } | ||
28 | |||
29 | try { | ||
30 | return \DateTimeImmutable::createFromFormat('U', 0)->add(new \DateInterval($duration))->getTimestamp(); | ||
31 | } catch (\Exception $e) { | ||
32 | throw new \InvalidArgumentException(sprintf('Cannot parse date interval "%s".', $duration), 0, $e); | ||
33 | } | ||
34 | } | ||
35 | } | ||
diff --git a/vendor/symfony/cache/Adapter/PdoAdapter.php b/vendor/symfony/cache/Adapter/PdoAdapter.php new file mode 100644 index 0000000..b18428d --- /dev/null +++ b/vendor/symfony/cache/Adapter/PdoAdapter.php | |||
@@ -0,0 +1,398 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
15 | use Symfony\Component\Cache\Marshaller\DefaultMarshaller; | ||
16 | use Symfony\Component\Cache\Marshaller\MarshallerInterface; | ||
17 | use Symfony\Component\Cache\PruneableInterface; | ||
18 | |||
19 | class PdoAdapter extends AbstractAdapter implements PruneableInterface | ||
20 | { | ||
21 | private const MAX_KEY_LENGTH = 255; | ||
22 | |||
23 | private MarshallerInterface $marshaller; | ||
24 | private \PDO $conn; | ||
25 | private string $dsn; | ||
26 | private string $driver; | ||
27 | private string $serverVersion; | ||
28 | private string $table = 'cache_items'; | ||
29 | private string $idCol = 'item_id'; | ||
30 | private string $dataCol = 'item_data'; | ||
31 | private string $lifetimeCol = 'item_lifetime'; | ||
32 | private string $timeCol = 'item_time'; | ||
33 | private ?string $username = null; | ||
34 | private ?string $password = null; | ||
35 | private array $connectionOptions = []; | ||
36 | private string $namespace; | ||
37 | |||
38 | /** | ||
39 | * You can either pass an existing database connection as PDO instance or | ||
40 | * a DSN string that will be used to lazy-connect to the database when the | ||
41 | * cache is actually used. | ||
42 | * | ||
43 | * List of available options: | ||
44 | * * db_table: The name of the table [default: cache_items] | ||
45 | * * db_id_col: The column where to store the cache id [default: item_id] | ||
46 | * * db_data_col: The column where to store the cache data [default: item_data] | ||
47 | * * db_lifetime_col: The column where to store the lifetime [default: item_lifetime] | ||
48 | * * db_time_col: The column where to store the timestamp [default: item_time] | ||
49 | * * db_username: The username when lazy-connect [default: ''] | ||
50 | * * db_password: The password when lazy-connect [default: ''] | ||
51 | * * db_connection_options: An array of driver-specific connection options [default: []] | ||
52 | * | ||
53 | * @throws InvalidArgumentException When first argument is not PDO nor Connection nor string | ||
54 | * @throws InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION | ||
55 | * @throws InvalidArgumentException When namespace contains invalid characters | ||
56 | */ | ||
57 | public function __construct(#[\SensitiveParameter] \PDO|string $connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], ?MarshallerInterface $marshaller = null) | ||
58 | { | ||
59 | if (\is_string($connOrDsn) && str_contains($connOrDsn, '://')) { | ||
60 | throw new InvalidArgumentException(sprintf('Usage of Doctrine DBAL URL with "%s" is not supported. Use a PDO DSN or "%s" instead.', __CLASS__, DoctrineDbalAdapter::class)); | ||
61 | } | ||
62 | |||
63 | if (isset($namespace[0]) && preg_match('#[^-+.A-Za-z0-9]#', $namespace, $match)) { | ||
64 | throw new InvalidArgumentException(sprintf('Namespace contains "%s" but only characters in [-+.A-Za-z0-9] are allowed.', $match[0])); | ||
65 | } | ||
66 | |||
67 | if ($connOrDsn instanceof \PDO) { | ||
68 | if (\PDO::ERRMODE_EXCEPTION !== $connOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) { | ||
69 | throw new InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION)).', __CLASS__)); | ||
70 | } | ||
71 | |||
72 | $this->conn = $connOrDsn; | ||
73 | } else { | ||
74 | $this->dsn = $connOrDsn; | ||
75 | } | ||
76 | |||
77 | $this->maxIdLength = self::MAX_KEY_LENGTH; | ||
78 | $this->table = $options['db_table'] ?? $this->table; | ||
79 | $this->idCol = $options['db_id_col'] ?? $this->idCol; | ||
80 | $this->dataCol = $options['db_data_col'] ?? $this->dataCol; | ||
81 | $this->lifetimeCol = $options['db_lifetime_col'] ?? $this->lifetimeCol; | ||
82 | $this->timeCol = $options['db_time_col'] ?? $this->timeCol; | ||
83 | $this->username = $options['db_username'] ?? $this->username; | ||
84 | $this->password = $options['db_password'] ?? $this->password; | ||
85 | $this->connectionOptions = $options['db_connection_options'] ?? $this->connectionOptions; | ||
86 | $this->namespace = $namespace; | ||
87 | $this->marshaller = $marshaller ?? new DefaultMarshaller(); | ||
88 | |||
89 | parent::__construct($namespace, $defaultLifetime); | ||
90 | } | ||
91 | |||
92 | public static function createConnection(#[\SensitiveParameter] string $dsn, array $options = []): \PDO|string | ||
93 | { | ||
94 | if ($options['lazy'] ?? true) { | ||
95 | return $dsn; | ||
96 | } | ||
97 | |||
98 | $pdo = new \PDO($dsn); | ||
99 | $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); | ||
100 | |||
101 | return $pdo; | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * Creates the table to store cache items which can be called once for setup. | ||
106 | * | ||
107 | * Cache ID are saved in a column of maximum length 255. Cache data is | ||
108 | * saved in a BLOB. | ||
109 | * | ||
110 | * @throws \PDOException When the table already exists | ||
111 | * @throws \DomainException When an unsupported PDO driver is used | ||
112 | */ | ||
113 | public function createTable(): void | ||
114 | { | ||
115 | $sql = match ($driver = $this->getDriver()) { | ||
116 | // We use varbinary for the ID column because it prevents unwanted conversions: | ||
117 | // - character set conversions between server and client | ||
118 | // - trailing space removal | ||
119 | // - case-insensitivity | ||
120 | // - language processing like é == e | ||
121 | 'mysql' => "CREATE TABLE $this->table ($this->idCol VARBINARY(255) NOT NULL PRIMARY KEY, $this->dataCol MEDIUMBLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8mb4_bin, ENGINE = InnoDB", | ||
122 | 'sqlite' => "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)", | ||
123 | 'pgsql' => "CREATE TABLE $this->table ($this->idCol VARCHAR(255) NOT NULL PRIMARY KEY, $this->dataCol BYTEA NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)", | ||
124 | 'oci' => "CREATE TABLE $this->table ($this->idCol VARCHAR2(255) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)", | ||
125 | 'sqlsrv' => "CREATE TABLE $this->table ($this->idCol VARCHAR(255) NOT NULL PRIMARY KEY, $this->dataCol VARBINARY(MAX) NOT NULL, $this->lifetimeCol INTEGER, $this->timeCol INTEGER NOT NULL)", | ||
126 | default => throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $driver)), | ||
127 | }; | ||
128 | |||
129 | $this->getConnection()->exec($sql); | ||
130 | } | ||
131 | |||
132 | public function prune(): bool | ||
133 | { | ||
134 | $deleteSql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol <= :time"; | ||
135 | |||
136 | if ('' !== $this->namespace) { | ||
137 | $deleteSql .= " AND $this->idCol LIKE :namespace"; | ||
138 | } | ||
139 | |||
140 | $connection = $this->getConnection(); | ||
141 | |||
142 | try { | ||
143 | $delete = $connection->prepare($deleteSql); | ||
144 | } catch (\PDOException) { | ||
145 | return true; | ||
146 | } | ||
147 | $delete->bindValue(':time', time(), \PDO::PARAM_INT); | ||
148 | |||
149 | if ('' !== $this->namespace) { | ||
150 | $delete->bindValue(':namespace', sprintf('%s%%', $this->namespace), \PDO::PARAM_STR); | ||
151 | } | ||
152 | try { | ||
153 | return $delete->execute(); | ||
154 | } catch (\PDOException) { | ||
155 | return true; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | protected function doFetch(array $ids): iterable | ||
160 | { | ||
161 | $connection = $this->getConnection(); | ||
162 | |||
163 | $now = time(); | ||
164 | $expired = []; | ||
165 | |||
166 | $sql = str_pad('', (\count($ids) << 1) - 1, '?,'); | ||
167 | $sql = "SELECT $this->idCol, CASE WHEN $this->lifetimeCol IS NULL OR $this->lifetimeCol + $this->timeCol > ? THEN $this->dataCol ELSE NULL END FROM $this->table WHERE $this->idCol IN ($sql)"; | ||
168 | $stmt = $connection->prepare($sql); | ||
169 | $stmt->bindValue($i = 1, $now, \PDO::PARAM_INT); | ||
170 | foreach ($ids as $id) { | ||
171 | $stmt->bindValue(++$i, $id); | ||
172 | } | ||
173 | $result = $stmt->execute(); | ||
174 | |||
175 | if (\is_object($result)) { | ||
176 | $result = $result->iterateNumeric(); | ||
177 | } else { | ||
178 | $stmt->setFetchMode(\PDO::FETCH_NUM); | ||
179 | $result = $stmt; | ||
180 | } | ||
181 | |||
182 | foreach ($result as $row) { | ||
183 | if (null === $row[1]) { | ||
184 | $expired[] = $row[0]; | ||
185 | } else { | ||
186 | yield $row[0] => $this->marshaller->unmarshall(\is_resource($row[1]) ? stream_get_contents($row[1]) : $row[1]); | ||
187 | } | ||
188 | } | ||
189 | |||
190 | if ($expired) { | ||
191 | $sql = str_pad('', (\count($expired) << 1) - 1, '?,'); | ||
192 | $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol <= ? AND $this->idCol IN ($sql)"; | ||
193 | $stmt = $connection->prepare($sql); | ||
194 | $stmt->bindValue($i = 1, $now, \PDO::PARAM_INT); | ||
195 | foreach ($expired as $id) { | ||
196 | $stmt->bindValue(++$i, $id); | ||
197 | } | ||
198 | $stmt->execute(); | ||
199 | } | ||
200 | } | ||
201 | |||
202 | protected function doHave(string $id): bool | ||
203 | { | ||
204 | $connection = $this->getConnection(); | ||
205 | |||
206 | $sql = "SELECT 1 FROM $this->table WHERE $this->idCol = :id AND ($this->lifetimeCol IS NULL OR $this->lifetimeCol + $this->timeCol > :time)"; | ||
207 | $stmt = $connection->prepare($sql); | ||
208 | |||
209 | $stmt->bindValue(':id', $id); | ||
210 | $stmt->bindValue(':time', time(), \PDO::PARAM_INT); | ||
211 | $stmt->execute(); | ||
212 | |||
213 | return (bool) $stmt->fetchColumn(); | ||
214 | } | ||
215 | |||
216 | protected function doClear(string $namespace): bool | ||
217 | { | ||
218 | $conn = $this->getConnection(); | ||
219 | |||
220 | if ('' === $namespace) { | ||
221 | if ('sqlite' === $this->getDriver()) { | ||
222 | $sql = "DELETE FROM $this->table"; | ||
223 | } else { | ||
224 | $sql = "TRUNCATE TABLE $this->table"; | ||
225 | } | ||
226 | } else { | ||
227 | $sql = "DELETE FROM $this->table WHERE $this->idCol LIKE '$namespace%'"; | ||
228 | } | ||
229 | |||
230 | try { | ||
231 | $conn->exec($sql); | ||
232 | } catch (\PDOException) { | ||
233 | } | ||
234 | |||
235 | return true; | ||
236 | } | ||
237 | |||
238 | protected function doDelete(array $ids): bool | ||
239 | { | ||
240 | $sql = str_pad('', (\count($ids) << 1) - 1, '?,'); | ||
241 | $sql = "DELETE FROM $this->table WHERE $this->idCol IN ($sql)"; | ||
242 | try { | ||
243 | $stmt = $this->getConnection()->prepare($sql); | ||
244 | $stmt->execute(array_values($ids)); | ||
245 | } catch (\PDOException) { | ||
246 | } | ||
247 | |||
248 | return true; | ||
249 | } | ||
250 | |||
251 | protected function doSave(array $values, int $lifetime): array|bool | ||
252 | { | ||
253 | if (!$values = $this->marshaller->marshall($values, $failed)) { | ||
254 | return $failed; | ||
255 | } | ||
256 | |||
257 | $conn = $this->getConnection(); | ||
258 | |||
259 | $driver = $this->getDriver(); | ||
260 | $insertSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)"; | ||
261 | |||
262 | switch (true) { | ||
263 | case 'mysql' === $driver: | ||
264 | $sql = $insertSql." ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->lifetimeCol = VALUES($this->lifetimeCol), $this->timeCol = VALUES($this->timeCol)"; | ||
265 | break; | ||
266 | case 'oci' === $driver: | ||
267 | // DUAL is Oracle specific dummy table | ||
268 | $sql = "MERGE INTO $this->table USING DUAL ON ($this->idCol = ?) ". | ||
269 | "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ". | ||
270 | "WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?"; | ||
271 | break; | ||
272 | case 'sqlsrv' === $driver && version_compare($this->getServerVersion(), '10', '>='): | ||
273 | // MERGE is only available since SQL Server 2008 and must be terminated by semicolon | ||
274 | // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx | ||
275 | $sql = "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = ?) ". | ||
276 | "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ". | ||
277 | "WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?;"; | ||
278 | break; | ||
279 | case 'sqlite' === $driver: | ||
280 | $sql = 'INSERT OR REPLACE'.substr($insertSql, 6); | ||
281 | break; | ||
282 | case 'pgsql' === $driver && version_compare($this->getServerVersion(), '9.5', '>='): | ||
283 | $sql = $insertSql." ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->lifetimeCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->lifetimeCol, EXCLUDED.$this->timeCol)"; | ||
284 | break; | ||
285 | default: | ||
286 | $driver = null; | ||
287 | $sql = "UPDATE $this->table SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id"; | ||
288 | break; | ||
289 | } | ||
290 | |||
291 | $now = time(); | ||
292 | $lifetime = $lifetime ?: null; | ||
293 | try { | ||
294 | $stmt = $conn->prepare($sql); | ||
295 | } catch (\PDOException $e) { | ||
296 | if ($this->isTableMissing($e) && (!$conn->inTransaction() || \in_array($driver, ['pgsql', 'sqlite', 'sqlsrv'], true))) { | ||
297 | $this->createTable(); | ||
298 | } | ||
299 | $stmt = $conn->prepare($sql); | ||
300 | } | ||
301 | |||
302 | // $id and $data are defined later in the loop. Binding is done by reference, values are read on execution. | ||
303 | if ('sqlsrv' === $driver || 'oci' === $driver) { | ||
304 | $stmt->bindParam(1, $id); | ||
305 | $stmt->bindParam(2, $id); | ||
306 | $stmt->bindParam(3, $data, \PDO::PARAM_LOB); | ||
307 | $stmt->bindValue(4, $lifetime, \PDO::PARAM_INT); | ||
308 | $stmt->bindValue(5, $now, \PDO::PARAM_INT); | ||
309 | $stmt->bindParam(6, $data, \PDO::PARAM_LOB); | ||
310 | $stmt->bindValue(7, $lifetime, \PDO::PARAM_INT); | ||
311 | $stmt->bindValue(8, $now, \PDO::PARAM_INT); | ||
312 | } else { | ||
313 | $stmt->bindParam(':id', $id); | ||
314 | $stmt->bindParam(':data', $data, \PDO::PARAM_LOB); | ||
315 | $stmt->bindValue(':lifetime', $lifetime, \PDO::PARAM_INT); | ||
316 | $stmt->bindValue(':time', $now, \PDO::PARAM_INT); | ||
317 | } | ||
318 | if (null === $driver) { | ||
319 | $insertStmt = $conn->prepare($insertSql); | ||
320 | |||
321 | $insertStmt->bindParam(':id', $id); | ||
322 | $insertStmt->bindParam(':data', $data, \PDO::PARAM_LOB); | ||
323 | $insertStmt->bindValue(':lifetime', $lifetime, \PDO::PARAM_INT); | ||
324 | $insertStmt->bindValue(':time', $now, \PDO::PARAM_INT); | ||
325 | } | ||
326 | |||
327 | foreach ($values as $id => $data) { | ||
328 | try { | ||
329 | $stmt->execute(); | ||
330 | } catch (\PDOException $e) { | ||
331 | if ($this->isTableMissing($e) && (!$conn->inTransaction() || \in_array($driver, ['pgsql', 'sqlite', 'sqlsrv'], true))) { | ||
332 | $this->createTable(); | ||
333 | } | ||
334 | $stmt->execute(); | ||
335 | } | ||
336 | if (null === $driver && !$stmt->rowCount()) { | ||
337 | try { | ||
338 | $insertStmt->execute(); | ||
339 | } catch (\PDOException) { | ||
340 | // A concurrent write won, let it be | ||
341 | } | ||
342 | } | ||
343 | } | ||
344 | |||
345 | return $failed; | ||
346 | } | ||
347 | |||
348 | /** | ||
349 | * @internal | ||
350 | */ | ||
351 | protected function getId(mixed $key): string | ||
352 | { | ||
353 | if ('pgsql' !== $this->getDriver()) { | ||
354 | return parent::getId($key); | ||
355 | } | ||
356 | |||
357 | if (str_contains($key, "\0") || str_contains($key, '%') || !preg_match('//u', $key)) { | ||
358 | $key = rawurlencode($key); | ||
359 | } | ||
360 | |||
361 | return parent::getId($key); | ||
362 | } | ||
363 | |||
364 | private function getConnection(): \PDO | ||
365 | { | ||
366 | if (!isset($this->conn)) { | ||
367 | $this->conn = new \PDO($this->dsn, $this->username, $this->password, $this->connectionOptions); | ||
368 | $this->conn->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); | ||
369 | } | ||
370 | |||
371 | return $this->conn; | ||
372 | } | ||
373 | |||
374 | private function getDriver(): string | ||
375 | { | ||
376 | return $this->driver ??= $this->getConnection()->getAttribute(\PDO::ATTR_DRIVER_NAME); | ||
377 | } | ||
378 | |||
379 | private function getServerVersion(): string | ||
380 | { | ||
381 | return $this->serverVersion ??= $this->getConnection()->getAttribute(\PDO::ATTR_SERVER_VERSION); | ||
382 | } | ||
383 | |||
384 | private function isTableMissing(\PDOException $exception): bool | ||
385 | { | ||
386 | $driver = $this->getDriver(); | ||
387 | [$sqlState, $code] = $exception->errorInfo ?? [null, $exception->getCode()]; | ||
388 | |||
389 | return match ($driver) { | ||
390 | 'pgsql' => '42P01' === $sqlState, | ||
391 | 'sqlite' => str_contains($exception->getMessage(), 'no such table:'), | ||
392 | 'oci' => 942 === $code, | ||
393 | 'sqlsrv' => 208 === $code, | ||
394 | 'mysql' => 1146 === $code, | ||
395 | default => false, | ||
396 | }; | ||
397 | } | ||
398 | } | ||
diff --git a/vendor/symfony/cache/Adapter/PhpArrayAdapter.php b/vendor/symfony/cache/Adapter/PhpArrayAdapter.php new file mode 100644 index 0000000..f92a238 --- /dev/null +++ b/vendor/symfony/cache/Adapter/PhpArrayAdapter.php | |||
@@ -0,0 +1,389 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Psr\Cache\CacheItemInterface; | ||
15 | use Psr\Cache\CacheItemPoolInterface; | ||
16 | use Symfony\Component\Cache\CacheItem; | ||
17 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
18 | use Symfony\Component\Cache\PruneableInterface; | ||
19 | use Symfony\Component\Cache\ResettableInterface; | ||
20 | use Symfony\Component\Cache\Traits\ContractsTrait; | ||
21 | use Symfony\Component\Cache\Traits\ProxyTrait; | ||
22 | use Symfony\Component\VarExporter\VarExporter; | ||
23 | use Symfony\Contracts\Cache\CacheInterface; | ||
24 | |||
25 | /** | ||
26 | * Caches items at warm up time using a PHP array that is stored in shared memory by OPCache since PHP 7.0. | ||
27 | * Warmed up items are read-only and run-time discovered items are cached using a fallback adapter. | ||
28 | * | ||
29 | * @author Titouan Galopin <galopintitouan@gmail.com> | ||
30 | * @author Nicolas Grekas <p@tchwork.com> | ||
31 | */ | ||
32 | class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInterface, ResettableInterface | ||
33 | { | ||
34 | use ContractsTrait; | ||
35 | use ProxyTrait; | ||
36 | |||
37 | private array $keys; | ||
38 | private array $values; | ||
39 | |||
40 | private static \Closure $createCacheItem; | ||
41 | private static array $valuesCache = []; | ||
42 | |||
43 | /** | ||
44 | * @param string $file The PHP file were values are cached | ||
45 | * @param AdapterInterface $fallbackPool A pool to fallback on when an item is not hit | ||
46 | */ | ||
47 | public function __construct( | ||
48 | private string $file, | ||
49 | AdapterInterface $fallbackPool, | ||
50 | ) { | ||
51 | $this->pool = $fallbackPool; | ||
52 | self::$createCacheItem ??= \Closure::bind( | ||
53 | static function ($key, $value, $isHit) { | ||
54 | $item = new CacheItem(); | ||
55 | $item->key = $key; | ||
56 | $item->value = $value; | ||
57 | $item->isHit = $isHit; | ||
58 | |||
59 | return $item; | ||
60 | }, | ||
61 | null, | ||
62 | CacheItem::class | ||
63 | ); | ||
64 | } | ||
65 | |||
66 | /** | ||
67 | * This adapter takes advantage of how PHP stores arrays in its latest versions. | ||
68 | * | ||
69 | * @param string $file The PHP file were values are cached | ||
70 | * @param CacheItemPoolInterface $fallbackPool A pool to fallback on when an item is not hit | ||
71 | */ | ||
72 | public static function create(string $file, CacheItemPoolInterface $fallbackPool): CacheItemPoolInterface | ||
73 | { | ||
74 | if (!$fallbackPool instanceof AdapterInterface) { | ||
75 | $fallbackPool = new ProxyAdapter($fallbackPool); | ||
76 | } | ||
77 | |||
78 | return new static($file, $fallbackPool); | ||
79 | } | ||
80 | |||
81 | public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed | ||
82 | { | ||
83 | if (!isset($this->values)) { | ||
84 | $this->initialize(); | ||
85 | } | ||
86 | if (!isset($this->keys[$key])) { | ||
87 | get_from_pool: | ||
88 | if ($this->pool instanceof CacheInterface) { | ||
89 | return $this->pool->get($key, $callback, $beta, $metadata); | ||
90 | } | ||
91 | |||
92 | return $this->doGet($this->pool, $key, $callback, $beta, $metadata); | ||
93 | } | ||
94 | $value = $this->values[$this->keys[$key]]; | ||
95 | |||
96 | if ('N;' === $value) { | ||
97 | return null; | ||
98 | } | ||
99 | try { | ||
100 | if ($value instanceof \Closure) { | ||
101 | return $value(); | ||
102 | } | ||
103 | } catch (\Throwable) { | ||
104 | unset($this->keys[$key]); | ||
105 | goto get_from_pool; | ||
106 | } | ||
107 | |||
108 | return $value; | ||
109 | } | ||
110 | |||
111 | public function getItem(mixed $key): CacheItem | ||
112 | { | ||
113 | if (!\is_string($key)) { | ||
114 | throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', get_debug_type($key))); | ||
115 | } | ||
116 | if (!isset($this->values)) { | ||
117 | $this->initialize(); | ||
118 | } | ||
119 | if (!isset($this->keys[$key])) { | ||
120 | return $this->pool->getItem($key); | ||
121 | } | ||
122 | |||
123 | $value = $this->values[$this->keys[$key]]; | ||
124 | $isHit = true; | ||
125 | |||
126 | if ('N;' === $value) { | ||
127 | $value = null; | ||
128 | } elseif ($value instanceof \Closure) { | ||
129 | try { | ||
130 | $value = $value(); | ||
131 | } catch (\Throwable) { | ||
132 | $value = null; | ||
133 | $isHit = false; | ||
134 | } | ||
135 | } | ||
136 | |||
137 | return (self::$createCacheItem)($key, $value, $isHit); | ||
138 | } | ||
139 | |||
140 | public function getItems(array $keys = []): iterable | ||
141 | { | ||
142 | foreach ($keys as $key) { | ||
143 | if (!\is_string($key)) { | ||
144 | throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', get_debug_type($key))); | ||
145 | } | ||
146 | } | ||
147 | if (!isset($this->values)) { | ||
148 | $this->initialize(); | ||
149 | } | ||
150 | |||
151 | return $this->generateItems($keys); | ||
152 | } | ||
153 | |||
154 | public function hasItem(mixed $key): bool | ||
155 | { | ||
156 | if (!\is_string($key)) { | ||
157 | throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', get_debug_type($key))); | ||
158 | } | ||
159 | if (!isset($this->values)) { | ||
160 | $this->initialize(); | ||
161 | } | ||
162 | |||
163 | return isset($this->keys[$key]) || $this->pool->hasItem($key); | ||
164 | } | ||
165 | |||
166 | public function deleteItem(mixed $key): bool | ||
167 | { | ||
168 | if (!\is_string($key)) { | ||
169 | throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', get_debug_type($key))); | ||
170 | } | ||
171 | if (!isset($this->values)) { | ||
172 | $this->initialize(); | ||
173 | } | ||
174 | |||
175 | return !isset($this->keys[$key]) && $this->pool->deleteItem($key); | ||
176 | } | ||
177 | |||
178 | public function deleteItems(array $keys): bool | ||
179 | { | ||
180 | $deleted = true; | ||
181 | $fallbackKeys = []; | ||
182 | |||
183 | foreach ($keys as $key) { | ||
184 | if (!\is_string($key)) { | ||
185 | throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', get_debug_type($key))); | ||
186 | } | ||
187 | |||
188 | if (isset($this->keys[$key])) { | ||
189 | $deleted = false; | ||
190 | } else { | ||
191 | $fallbackKeys[] = $key; | ||
192 | } | ||
193 | } | ||
194 | if (!isset($this->values)) { | ||
195 | $this->initialize(); | ||
196 | } | ||
197 | |||
198 | if ($fallbackKeys) { | ||
199 | $deleted = $this->pool->deleteItems($fallbackKeys) && $deleted; | ||
200 | } | ||
201 | |||
202 | return $deleted; | ||
203 | } | ||
204 | |||
205 | public function save(CacheItemInterface $item): bool | ||
206 | { | ||
207 | if (!isset($this->values)) { | ||
208 | $this->initialize(); | ||
209 | } | ||
210 | |||
211 | return !isset($this->keys[$item->getKey()]) && $this->pool->save($item); | ||
212 | } | ||
213 | |||
214 | public function saveDeferred(CacheItemInterface $item): bool | ||
215 | { | ||
216 | if (!isset($this->values)) { | ||
217 | $this->initialize(); | ||
218 | } | ||
219 | |||
220 | return !isset($this->keys[$item->getKey()]) && $this->pool->saveDeferred($item); | ||
221 | } | ||
222 | |||
223 | public function commit(): bool | ||
224 | { | ||
225 | return $this->pool->commit(); | ||
226 | } | ||
227 | |||
228 | public function clear(string $prefix = ''): bool | ||
229 | { | ||
230 | $this->keys = $this->values = []; | ||
231 | |||
232 | $cleared = @unlink($this->file) || !file_exists($this->file); | ||
233 | unset(self::$valuesCache[$this->file]); | ||
234 | |||
235 | if ($this->pool instanceof AdapterInterface) { | ||
236 | return $this->pool->clear($prefix) && $cleared; | ||
237 | } | ||
238 | |||
239 | return $this->pool->clear() && $cleared; | ||
240 | } | ||
241 | |||
242 | /** | ||
243 | * Store an array of cached values. | ||
244 | * | ||
245 | * @param array $values The cached values | ||
246 | * | ||
247 | * @return string[] A list of classes to preload on PHP 7.4+ | ||
248 | */ | ||
249 | public function warmUp(array $values): array | ||
250 | { | ||
251 | if (file_exists($this->file)) { | ||
252 | if (!is_file($this->file)) { | ||
253 | throw new InvalidArgumentException(sprintf('Cache path exists and is not a file: "%s".', $this->file)); | ||
254 | } | ||
255 | |||
256 | if (!is_writable($this->file)) { | ||
257 | throw new InvalidArgumentException(sprintf('Cache file is not writable: "%s".', $this->file)); | ||
258 | } | ||
259 | } else { | ||
260 | $directory = \dirname($this->file); | ||
261 | |||
262 | if (!is_dir($directory) && !@mkdir($directory, 0777, true)) { | ||
263 | throw new InvalidArgumentException(sprintf('Cache directory does not exist and cannot be created: "%s".', $directory)); | ||
264 | } | ||
265 | |||
266 | if (!is_writable($directory)) { | ||
267 | throw new InvalidArgumentException(sprintf('Cache directory is not writable: "%s".', $directory)); | ||
268 | } | ||
269 | } | ||
270 | |||
271 | $preload = []; | ||
272 | $dumpedValues = ''; | ||
273 | $dumpedMap = []; | ||
274 | $dump = <<<'EOF' | ||
275 | <?php | ||
276 | |||
277 | // This file has been auto-generated by the Symfony Cache Component. | ||
278 | |||
279 | return [[ | ||
280 | |||
281 | |||
282 | EOF; | ||
283 | |||
284 | foreach ($values as $key => $value) { | ||
285 | CacheItem::validateKey(\is_int($key) ? (string) $key : $key); | ||
286 | $isStaticValue = true; | ||
287 | |||
288 | if (null === $value) { | ||
289 | $value = "'N;'"; | ||
290 | } elseif (\is_object($value) || \is_array($value)) { | ||
291 | try { | ||
292 | $value = VarExporter::export($value, $isStaticValue, $preload); | ||
293 | } catch (\Exception $e) { | ||
294 | throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, get_debug_type($value)), 0, $e); | ||
295 | } | ||
296 | } elseif (\is_string($value)) { | ||
297 | // Wrap "N;" in a closure to not confuse it with an encoded `null` | ||
298 | if ('N;' === $value) { | ||
299 | $isStaticValue = false; | ||
300 | } | ||
301 | $value = var_export($value, true); | ||
302 | } elseif (!\is_scalar($value)) { | ||
303 | throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, get_debug_type($value))); | ||
304 | } else { | ||
305 | $value = var_export($value, true); | ||
306 | } | ||
307 | |||
308 | if (!$isStaticValue) { | ||
309 | $value = str_replace("\n", "\n ", $value); | ||
310 | $value = "static function () {\n return {$value};\n}"; | ||
311 | } | ||
312 | $hash = hash('xxh128', $value); | ||
313 | |||
314 | if (null === $id = $dumpedMap[$hash] ?? null) { | ||
315 | $id = $dumpedMap[$hash] = \count($dumpedMap); | ||
316 | $dumpedValues .= "{$id} => {$value},\n"; | ||
317 | } | ||
318 | |||
319 | $dump .= var_export($key, true)." => {$id},\n"; | ||
320 | } | ||
321 | |||
322 | $dump .= "\n], [\n\n{$dumpedValues}\n]];\n"; | ||
323 | |||
324 | $tmpFile = uniqid($this->file, true); | ||
325 | |||
326 | file_put_contents($tmpFile, $dump); | ||
327 | @chmod($tmpFile, 0666 & ~umask()); | ||
328 | unset($serialized, $value, $dump); | ||
329 | |||
330 | @rename($tmpFile, $this->file); | ||
331 | unset(self::$valuesCache[$this->file]); | ||
332 | |||
333 | $this->initialize(); | ||
334 | |||
335 | return $preload; | ||
336 | } | ||
337 | |||
338 | /** | ||
339 | * Load the cache file. | ||
340 | */ | ||
341 | private function initialize(): void | ||
342 | { | ||
343 | if (isset(self::$valuesCache[$this->file])) { | ||
344 | $values = self::$valuesCache[$this->file]; | ||
345 | } elseif (!is_file($this->file)) { | ||
346 | $this->keys = $this->values = []; | ||
347 | |||
348 | return; | ||
349 | } else { | ||
350 | $values = self::$valuesCache[$this->file] = (include $this->file) ?: [[], []]; | ||
351 | } | ||
352 | |||
353 | if (2 !== \count($values) || !isset($values[0], $values[1])) { | ||
354 | $this->keys = $this->values = []; | ||
355 | } else { | ||
356 | [$this->keys, $this->values] = $values; | ||
357 | } | ||
358 | } | ||
359 | |||
360 | private function generateItems(array $keys): \Generator | ||
361 | { | ||
362 | $f = self::$createCacheItem; | ||
363 | $fallbackKeys = []; | ||
364 | |||
365 | foreach ($keys as $key) { | ||
366 | if (isset($this->keys[$key])) { | ||
367 | $value = $this->values[$this->keys[$key]]; | ||
368 | |||
369 | if ('N;' === $value) { | ||
370 | yield $key => $f($key, null, true); | ||
371 | } elseif ($value instanceof \Closure) { | ||
372 | try { | ||
373 | yield $key => $f($key, $value(), true); | ||
374 | } catch (\Throwable) { | ||
375 | yield $key => $f($key, null, false); | ||
376 | } | ||
377 | } else { | ||
378 | yield $key => $f($key, $value, true); | ||
379 | } | ||
380 | } else { | ||
381 | $fallbackKeys[] = $key; | ||
382 | } | ||
383 | } | ||
384 | |||
385 | if ($fallbackKeys) { | ||
386 | yield from $this->pool->getItems($fallbackKeys); | ||
387 | } | ||
388 | } | ||
389 | } | ||
diff --git a/vendor/symfony/cache/Adapter/PhpFilesAdapter.php b/vendor/symfony/cache/Adapter/PhpFilesAdapter.php new file mode 100644 index 0000000..917ff16 --- /dev/null +++ b/vendor/symfony/cache/Adapter/PhpFilesAdapter.php | |||
@@ -0,0 +1,314 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Symfony\Component\Cache\Exception\CacheException; | ||
15 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
16 | use Symfony\Component\Cache\PruneableInterface; | ||
17 | use Symfony\Component\Cache\Traits\FilesystemCommonTrait; | ||
18 | use Symfony\Component\VarExporter\VarExporter; | ||
19 | |||
20 | /** | ||
21 | * @author Piotr Stankowski <git@trakos.pl> | ||
22 | * @author Nicolas Grekas <p@tchwork.com> | ||
23 | * @author Rob Frawley 2nd <rmf@src.run> | ||
24 | */ | ||
25 | class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface | ||
26 | { | ||
27 | use FilesystemCommonTrait { | ||
28 | doClear as private doCommonClear; | ||
29 | doDelete as private doCommonDelete; | ||
30 | } | ||
31 | |||
32 | private \Closure $includeHandler; | ||
33 | private array $values = []; | ||
34 | private array $files = []; | ||
35 | |||
36 | private static int $startTime; | ||
37 | private static array $valuesCache = []; | ||
38 | |||
39 | /** | ||
40 | * @param bool $appendOnly Set to `true` to gain extra performance when the items stored in this pool never expire. | ||
41 | * Doing so is encouraged because it fits perfectly OPcache's memory model. | ||
42 | * | ||
43 | * @throws CacheException if OPcache is not enabled | ||
44 | */ | ||
45 | public function __construct( | ||
46 | string $namespace = '', | ||
47 | int $defaultLifetime = 0, | ||
48 | ?string $directory = null, | ||
49 | private bool $appendOnly = false, | ||
50 | ) { | ||
51 | self::$startTime ??= $_SERVER['REQUEST_TIME'] ?? time(); | ||
52 | parent::__construct('', $defaultLifetime); | ||
53 | $this->init($namespace, $directory); | ||
54 | $this->includeHandler = static function ($type, $msg, $file, $line) { | ||
55 | throw new \ErrorException($msg, 0, $type, $file, $line); | ||
56 | }; | ||
57 | } | ||
58 | |||
59 | public static function isSupported(): bool | ||
60 | { | ||
61 | self::$startTime ??= $_SERVER['REQUEST_TIME'] ?? time(); | ||
62 | |||
63 | return \function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOL) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) || filter_var(\ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOL)); | ||
64 | } | ||
65 | |||
66 | public function prune(): bool | ||
67 | { | ||
68 | $time = time(); | ||
69 | $pruned = true; | ||
70 | $getExpiry = true; | ||
71 | |||
72 | set_error_handler($this->includeHandler); | ||
73 | try { | ||
74 | foreach ($this->scanHashDir($this->directory) as $file) { | ||
75 | try { | ||
76 | if (\is_array($expiresAt = include $file)) { | ||
77 | $expiresAt = $expiresAt[0]; | ||
78 | } | ||
79 | } catch (\ErrorException $e) { | ||
80 | $expiresAt = $time; | ||
81 | } | ||
82 | |||
83 | if ($time >= $expiresAt) { | ||
84 | $pruned = ($this->doUnlink($file) || !file_exists($file)) && $pruned; | ||
85 | } | ||
86 | } | ||
87 | } finally { | ||
88 | restore_error_handler(); | ||
89 | } | ||
90 | |||
91 | return $pruned; | ||
92 | } | ||
93 | |||
94 | protected function doFetch(array $ids): iterable | ||
95 | { | ||
96 | if ($this->appendOnly) { | ||
97 | $now = 0; | ||
98 | $missingIds = []; | ||
99 | } else { | ||
100 | $now = time(); | ||
101 | $missingIds = $ids; | ||
102 | $ids = []; | ||
103 | } | ||
104 | $values = []; | ||
105 | |||
106 | begin: | ||
107 | $getExpiry = false; | ||
108 | |||
109 | foreach ($ids as $id) { | ||
110 | if (null === $value = $this->values[$id] ?? null) { | ||
111 | $missingIds[] = $id; | ||
112 | } elseif ('N;' === $value) { | ||
113 | $values[$id] = null; | ||
114 | } elseif (!\is_object($value)) { | ||
115 | $values[$id] = $value; | ||
116 | } elseif (!$value instanceof LazyValue) { | ||
117 | $values[$id] = $value(); | ||
118 | } elseif (false === $values[$id] = include $value->file) { | ||
119 | unset($values[$id], $this->values[$id]); | ||
120 | $missingIds[] = $id; | ||
121 | } | ||
122 | if (!$this->appendOnly) { | ||
123 | unset($this->values[$id]); | ||
124 | } | ||
125 | } | ||
126 | |||
127 | if (!$missingIds) { | ||
128 | return $values; | ||
129 | } | ||
130 | |||
131 | set_error_handler($this->includeHandler); | ||
132 | try { | ||
133 | $getExpiry = true; | ||
134 | |||
135 | foreach ($missingIds as $k => $id) { | ||
136 | try { | ||
137 | $file = $this->files[$id] ??= $this->getFile($id); | ||
138 | |||
139 | if (isset(self::$valuesCache[$file])) { | ||
140 | [$expiresAt, $this->values[$id]] = self::$valuesCache[$file]; | ||
141 | } elseif (\is_array($expiresAt = include $file)) { | ||
142 | if ($this->appendOnly) { | ||
143 | self::$valuesCache[$file] = $expiresAt; | ||
144 | } | ||
145 | |||
146 | [$expiresAt, $this->values[$id]] = $expiresAt; | ||
147 | } elseif ($now < $expiresAt) { | ||
148 | $this->values[$id] = new LazyValue($file); | ||
149 | } | ||
150 | |||
151 | if ($now >= $expiresAt) { | ||
152 | unset($this->values[$id], $missingIds[$k], self::$valuesCache[$file]); | ||
153 | } | ||
154 | } catch (\ErrorException $e) { | ||
155 | unset($missingIds[$k]); | ||
156 | } | ||
157 | } | ||
158 | } finally { | ||
159 | restore_error_handler(); | ||
160 | } | ||
161 | |||
162 | $ids = $missingIds; | ||
163 | $missingIds = []; | ||
164 | goto begin; | ||
165 | } | ||
166 | |||
167 | protected function doHave(string $id): bool | ||
168 | { | ||
169 | if ($this->appendOnly && isset($this->values[$id])) { | ||
170 | return true; | ||
171 | } | ||
172 | |||
173 | set_error_handler($this->includeHandler); | ||
174 | try { | ||
175 | $file = $this->files[$id] ??= $this->getFile($id); | ||
176 | $getExpiry = true; | ||
177 | |||
178 | if (isset(self::$valuesCache[$file])) { | ||
179 | [$expiresAt, $value] = self::$valuesCache[$file]; | ||
180 | } elseif (\is_array($expiresAt = include $file)) { | ||
181 | if ($this->appendOnly) { | ||
182 | self::$valuesCache[$file] = $expiresAt; | ||
183 | } | ||
184 | |||
185 | [$expiresAt, $value] = $expiresAt; | ||
186 | } elseif ($this->appendOnly) { | ||
187 | $value = new LazyValue($file); | ||
188 | } | ||
189 | } catch (\ErrorException) { | ||
190 | return false; | ||
191 | } finally { | ||
192 | restore_error_handler(); | ||
193 | } | ||
194 | if ($this->appendOnly) { | ||
195 | $now = 0; | ||
196 | $this->values[$id] = $value; | ||
197 | } else { | ||
198 | $now = time(); | ||
199 | } | ||
200 | |||
201 | return $now < $expiresAt; | ||
202 | } | ||
203 | |||
204 | protected function doSave(array $values, int $lifetime): array|bool | ||
205 | { | ||
206 | $ok = true; | ||
207 | $expiry = $lifetime ? time() + $lifetime : 'PHP_INT_MAX'; | ||
208 | $allowCompile = self::isSupported(); | ||
209 | |||
210 | foreach ($values as $key => $value) { | ||
211 | unset($this->values[$key]); | ||
212 | $isStaticValue = true; | ||
213 | if (null === $value) { | ||
214 | $value = "'N;'"; | ||
215 | } elseif (\is_object($value) || \is_array($value)) { | ||
216 | try { | ||
217 | $value = VarExporter::export($value, $isStaticValue); | ||
218 | } catch (\Exception $e) { | ||
219 | throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, get_debug_type($value)), 0, $e); | ||
220 | } | ||
221 | } elseif (\is_string($value)) { | ||
222 | // Wrap "N;" in a closure to not confuse it with an encoded `null` | ||
223 | if ('N;' === $value) { | ||
224 | $isStaticValue = false; | ||
225 | } | ||
226 | $value = var_export($value, true); | ||
227 | } elseif (!\is_scalar($value)) { | ||
228 | throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, get_debug_type($value))); | ||
229 | } else { | ||
230 | $value = var_export($value, true); | ||
231 | } | ||
232 | |||
233 | $encodedKey = rawurlencode($key); | ||
234 | |||
235 | if ($isStaticValue) { | ||
236 | $value = "return [{$expiry}, {$value}];"; | ||
237 | } elseif ($this->appendOnly) { | ||
238 | $value = "return [{$expiry}, static fn () => {$value}];"; | ||
239 | } else { | ||
240 | // We cannot use a closure here because of https://bugs.php.net/76982 | ||
241 | $value = str_replace('\Symfony\Component\VarExporter\Internal\\', '', $value); | ||
242 | $value = "namespace Symfony\Component\VarExporter\Internal;\n\nreturn \$getExpiry ? {$expiry} : {$value};"; | ||
243 | } | ||
244 | |||
245 | $file = $this->files[$key] = $this->getFile($key, true); | ||
246 | // Since OPcache only compiles files older than the script execution start, set the file's mtime in the past | ||
247 | $ok = $this->write($file, "<?php //{$encodedKey}\n\n{$value}\n", self::$startTime - 10) && $ok; | ||
248 | |||
249 | if ($allowCompile) { | ||
250 | @opcache_invalidate($file, true); | ||
251 | @opcache_compile_file($file); | ||
252 | } | ||
253 | unset(self::$valuesCache[$file]); | ||
254 | } | ||
255 | |||
256 | if (!$ok && !is_writable($this->directory)) { | ||
257 | throw new CacheException(sprintf('Cache directory is not writable (%s).', $this->directory)); | ||
258 | } | ||
259 | |||
260 | return $ok; | ||
261 | } | ||
262 | |||
263 | protected function doClear(string $namespace): bool | ||
264 | { | ||
265 | $this->values = []; | ||
266 | |||
267 | return $this->doCommonClear($namespace); | ||
268 | } | ||
269 | |||
270 | protected function doDelete(array $ids): bool | ||
271 | { | ||
272 | foreach ($ids as $id) { | ||
273 | unset($this->values[$id]); | ||
274 | } | ||
275 | |||
276 | return $this->doCommonDelete($ids); | ||
277 | } | ||
278 | |||
279 | protected function doUnlink(string $file): bool | ||
280 | { | ||
281 | unset(self::$valuesCache[$file]); | ||
282 | |||
283 | if (self::isSupported()) { | ||
284 | @opcache_invalidate($file, true); | ||
285 | } | ||
286 | |||
287 | return @unlink($file); | ||
288 | } | ||
289 | |||
290 | private function getFileKey(string $file): string | ||
291 | { | ||
292 | if (!$h = @fopen($file, 'r')) { | ||
293 | return ''; | ||
294 | } | ||
295 | |||
296 | $encodedKey = substr(fgets($h), 8); | ||
297 | fclose($h); | ||
298 | |||
299 | return rawurldecode(rtrim($encodedKey)); | ||
300 | } | ||
301 | } | ||
302 | |||
303 | /** | ||
304 | * @internal | ||
305 | */ | ||
306 | class LazyValue | ||
307 | { | ||
308 | public string $file; | ||
309 | |||
310 | public function __construct(string $file) | ||
311 | { | ||
312 | $this->file = $file; | ||
313 | } | ||
314 | } | ||
diff --git a/vendor/symfony/cache/Adapter/ProxyAdapter.php b/vendor/symfony/cache/Adapter/ProxyAdapter.php new file mode 100644 index 0000000..c022dd5 --- /dev/null +++ b/vendor/symfony/cache/Adapter/ProxyAdapter.php | |||
@@ -0,0 +1,206 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Psr\Cache\CacheItemInterface; | ||
15 | use Psr\Cache\CacheItemPoolInterface; | ||
16 | use Symfony\Component\Cache\CacheItem; | ||
17 | use Symfony\Component\Cache\PruneableInterface; | ||
18 | use Symfony\Component\Cache\ResettableInterface; | ||
19 | use Symfony\Component\Cache\Traits\ContractsTrait; | ||
20 | use Symfony\Component\Cache\Traits\ProxyTrait; | ||
21 | use Symfony\Contracts\Cache\CacheInterface; | ||
22 | |||
23 | /** | ||
24 | * @author Nicolas Grekas <p@tchwork.com> | ||
25 | */ | ||
26 | class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterface, ResettableInterface | ||
27 | { | ||
28 | use ContractsTrait; | ||
29 | use ProxyTrait; | ||
30 | |||
31 | private string $namespace = ''; | ||
32 | private int $namespaceLen; | ||
33 | private string $poolHash; | ||
34 | private int $defaultLifetime; | ||
35 | |||
36 | private static \Closure $createCacheItem; | ||
37 | private static \Closure $setInnerItem; | ||
38 | |||
39 | public function __construct(CacheItemPoolInterface $pool, string $namespace = '', int $defaultLifetime = 0) | ||
40 | { | ||
41 | $this->pool = $pool; | ||
42 | $this->poolHash = spl_object_hash($pool); | ||
43 | if ('' !== $namespace) { | ||
44 | \assert('' !== CacheItem::validateKey($namespace)); | ||
45 | $this->namespace = $namespace; | ||
46 | } | ||
47 | $this->namespaceLen = \strlen($namespace); | ||
48 | $this->defaultLifetime = $defaultLifetime; | ||
49 | self::$createCacheItem ??= \Closure::bind( | ||
50 | static function ($key, $innerItem, $poolHash) { | ||
51 | $item = new CacheItem(); | ||
52 | $item->key = $key; | ||
53 | |||
54 | if (null === $innerItem) { | ||
55 | return $item; | ||
56 | } | ||
57 | |||
58 | $item->value = $innerItem->get(); | ||
59 | $item->isHit = $innerItem->isHit(); | ||
60 | $item->innerItem = $innerItem; | ||
61 | $item->poolHash = $poolHash; | ||
62 | |||
63 | if (!$item->unpack() && $innerItem instanceof CacheItem) { | ||
64 | $item->metadata = $innerItem->metadata; | ||
65 | } | ||
66 | $innerItem->set(null); | ||
67 | |||
68 | return $item; | ||
69 | }, | ||
70 | null, | ||
71 | CacheItem::class | ||
72 | ); | ||
73 | self::$setInnerItem ??= \Closure::bind( | ||
74 | static function (CacheItemInterface $innerItem, CacheItem $item, $expiry = null) { | ||
75 | $innerItem->set($item->pack()); | ||
76 | $innerItem->expiresAt(($expiry ?? $item->expiry) ? \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $expiry ?? $item->expiry)) : null); | ||
77 | }, | ||
78 | null, | ||
79 | CacheItem::class | ||
80 | ); | ||
81 | } | ||
82 | |||
83 | public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed | ||
84 | { | ||
85 | if (!$this->pool instanceof CacheInterface) { | ||
86 | return $this->doGet($this, $key, $callback, $beta, $metadata); | ||
87 | } | ||
88 | |||
89 | return $this->pool->get($this->getId($key), function ($innerItem, bool &$save) use ($key, $callback) { | ||
90 | $item = (self::$createCacheItem)($key, $innerItem, $this->poolHash); | ||
91 | $item->set($value = $callback($item, $save)); | ||
92 | (self::$setInnerItem)($innerItem, $item); | ||
93 | |||
94 | return $value; | ||
95 | }, $beta, $metadata); | ||
96 | } | ||
97 | |||
98 | public function getItem(mixed $key): CacheItem | ||
99 | { | ||
100 | $item = $this->pool->getItem($this->getId($key)); | ||
101 | |||
102 | return (self::$createCacheItem)($key, $item, $this->poolHash); | ||
103 | } | ||
104 | |||
105 | public function getItems(array $keys = []): iterable | ||
106 | { | ||
107 | if ($this->namespaceLen) { | ||
108 | foreach ($keys as $i => $key) { | ||
109 | $keys[$i] = $this->getId($key); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | return $this->generateItems($this->pool->getItems($keys)); | ||
114 | } | ||
115 | |||
116 | public function hasItem(mixed $key): bool | ||
117 | { | ||
118 | return $this->pool->hasItem($this->getId($key)); | ||
119 | } | ||
120 | |||
121 | public function clear(string $prefix = ''): bool | ||
122 | { | ||
123 | if ($this->pool instanceof AdapterInterface) { | ||
124 | return $this->pool->clear($this->namespace.$prefix); | ||
125 | } | ||
126 | |||
127 | return $this->pool->clear(); | ||
128 | } | ||
129 | |||
130 | public function deleteItem(mixed $key): bool | ||
131 | { | ||
132 | return $this->pool->deleteItem($this->getId($key)); | ||
133 | } | ||
134 | |||
135 | public function deleteItems(array $keys): bool | ||
136 | { | ||
137 | if ($this->namespaceLen) { | ||
138 | foreach ($keys as $i => $key) { | ||
139 | $keys[$i] = $this->getId($key); | ||
140 | } | ||
141 | } | ||
142 | |||
143 | return $this->pool->deleteItems($keys); | ||
144 | } | ||
145 | |||
146 | public function save(CacheItemInterface $item): bool | ||
147 | { | ||
148 | return $this->doSave($item, __FUNCTION__); | ||
149 | } | ||
150 | |||
151 | public function saveDeferred(CacheItemInterface $item): bool | ||
152 | { | ||
153 | return $this->doSave($item, __FUNCTION__); | ||
154 | } | ||
155 | |||
156 | public function commit(): bool | ||
157 | { | ||
158 | return $this->pool->commit(); | ||
159 | } | ||
160 | |||
161 | private function doSave(CacheItemInterface $item, string $method): bool | ||
162 | { | ||
163 | if (!$item instanceof CacheItem) { | ||
164 | return false; | ||
165 | } | ||
166 | $castItem = (array) $item; | ||
167 | |||
168 | if (null === $castItem["\0*\0expiry"] && 0 < $this->defaultLifetime) { | ||
169 | $castItem["\0*\0expiry"] = microtime(true) + $this->defaultLifetime; | ||
170 | } | ||
171 | |||
172 | if ($castItem["\0*\0poolHash"] === $this->poolHash && $castItem["\0*\0innerItem"]) { | ||
173 | $innerItem = $castItem["\0*\0innerItem"]; | ||
174 | } elseif ($this->pool instanceof AdapterInterface) { | ||
175 | // this is an optimization specific for AdapterInterface implementations | ||
176 | // so we can save a round-trip to the backend by just creating a new item | ||
177 | $innerItem = (self::$createCacheItem)($this->namespace.$castItem["\0*\0key"], null, $this->poolHash); | ||
178 | } else { | ||
179 | $innerItem = $this->pool->getItem($this->namespace.$castItem["\0*\0key"]); | ||
180 | } | ||
181 | |||
182 | (self::$setInnerItem)($innerItem, $item, $castItem["\0*\0expiry"]); | ||
183 | |||
184 | return $this->pool->$method($innerItem); | ||
185 | } | ||
186 | |||
187 | private function generateItems(iterable $items): \Generator | ||
188 | { | ||
189 | $f = self::$createCacheItem; | ||
190 | |||
191 | foreach ($items as $key => $item) { | ||
192 | if ($this->namespaceLen) { | ||
193 | $key = substr($key, $this->namespaceLen); | ||
194 | } | ||
195 | |||
196 | yield $key => $f($key, $item, $this->poolHash); | ||
197 | } | ||
198 | } | ||
199 | |||
200 | private function getId(mixed $key): string | ||
201 | { | ||
202 | \assert('' !== CacheItem::validateKey($key)); | ||
203 | |||
204 | return $this->namespace.$key; | ||
205 | } | ||
206 | } | ||
diff --git a/vendor/symfony/cache/Adapter/Psr16Adapter.php b/vendor/symfony/cache/Adapter/Psr16Adapter.php new file mode 100644 index 0000000..a72b037 --- /dev/null +++ b/vendor/symfony/cache/Adapter/Psr16Adapter.php | |||
@@ -0,0 +1,71 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Psr\SimpleCache\CacheInterface; | ||
15 | use Symfony\Component\Cache\PruneableInterface; | ||
16 | use Symfony\Component\Cache\ResettableInterface; | ||
17 | use Symfony\Component\Cache\Traits\ProxyTrait; | ||
18 | |||
19 | /** | ||
20 | * Turns a PSR-16 cache into a PSR-6 one. | ||
21 | * | ||
22 | * @author Nicolas Grekas <p@tchwork.com> | ||
23 | */ | ||
24 | class Psr16Adapter extends AbstractAdapter implements PruneableInterface, ResettableInterface | ||
25 | { | ||
26 | use ProxyTrait; | ||
27 | |||
28 | /** | ||
29 | * @internal | ||
30 | */ | ||
31 | protected const NS_SEPARATOR = '_'; | ||
32 | |||
33 | private object $miss; | ||
34 | |||
35 | public function __construct(CacheInterface $pool, string $namespace = '', int $defaultLifetime = 0) | ||
36 | { | ||
37 | parent::__construct($namespace, $defaultLifetime); | ||
38 | |||
39 | $this->pool = $pool; | ||
40 | $this->miss = new \stdClass(); | ||
41 | } | ||
42 | |||
43 | protected function doFetch(array $ids): iterable | ||
44 | { | ||
45 | foreach ($this->pool->getMultiple($ids, $this->miss) as $key => $value) { | ||
46 | if ($this->miss !== $value) { | ||
47 | yield $key => $value; | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | protected function doHave(string $id): bool | ||
53 | { | ||
54 | return $this->pool->has($id); | ||
55 | } | ||
56 | |||
57 | protected function doClear(string $namespace): bool | ||
58 | { | ||
59 | return $this->pool->clear(); | ||
60 | } | ||
61 | |||
62 | protected function doDelete(array $ids): bool | ||
63 | { | ||
64 | return $this->pool->deleteMultiple($ids); | ||
65 | } | ||
66 | |||
67 | protected function doSave(array $values, int $lifetime): array|bool | ||
68 | { | ||
69 | return $this->pool->setMultiple($values, 0 === $lifetime ? null : $lifetime); | ||
70 | } | ||
71 | } | ||
diff --git a/vendor/symfony/cache/Adapter/RedisAdapter.php b/vendor/symfony/cache/Adapter/RedisAdapter.php new file mode 100644 index 0000000..e33f2f6 --- /dev/null +++ b/vendor/symfony/cache/Adapter/RedisAdapter.php | |||
@@ -0,0 +1,25 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Symfony\Component\Cache\Marshaller\MarshallerInterface; | ||
15 | use Symfony\Component\Cache\Traits\RedisTrait; | ||
16 | |||
17 | class RedisAdapter extends AbstractAdapter | ||
18 | { | ||
19 | use RedisTrait; | ||
20 | |||
21 | public function __construct(\Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface|\Relay\Relay $redis, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null) | ||
22 | { | ||
23 | $this->init($redis, $namespace, $defaultLifetime, $marshaller); | ||
24 | } | ||
25 | } | ||
diff --git a/vendor/symfony/cache/Adapter/RedisTagAwareAdapter.php b/vendor/symfony/cache/Adapter/RedisTagAwareAdapter.php new file mode 100644 index 0000000..f71622b --- /dev/null +++ b/vendor/symfony/cache/Adapter/RedisTagAwareAdapter.php | |||
@@ -0,0 +1,310 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Predis\Connection\Aggregate\ClusterInterface; | ||
15 | use Predis\Connection\Aggregate\PredisCluster; | ||
16 | use Predis\Connection\Aggregate\ReplicationInterface; | ||
17 | use Predis\Response\ErrorInterface; | ||
18 | use Predis\Response\Status; | ||
19 | use Relay\Relay; | ||
20 | use Symfony\Component\Cache\CacheItem; | ||
21 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
22 | use Symfony\Component\Cache\Exception\LogicException; | ||
23 | use Symfony\Component\Cache\Marshaller\DeflateMarshaller; | ||
24 | use Symfony\Component\Cache\Marshaller\MarshallerInterface; | ||
25 | use Symfony\Component\Cache\Marshaller\TagAwareMarshaller; | ||
26 | use Symfony\Component\Cache\Traits\RedisTrait; | ||
27 | |||
28 | /** | ||
29 | * Stores tag id <> cache id relationship as a Redis Set. | ||
30 | * | ||
31 | * Set (tag relation info) is stored without expiry (non-volatile), while cache always gets an expiry (volatile) even | ||
32 | * if not set by caller. Thus if you configure redis with the right eviction policy you can be safe this tag <> cache | ||
33 | * relationship survives eviction (cache cleanup when Redis runs out of memory). | ||
34 | * | ||
35 | * Redis server 2.8+ with any `volatile-*` eviction policy, OR `noeviction` if you're sure memory will NEVER fill up | ||
36 | * | ||
37 | * Design limitations: | ||
38 | * - Max 4 billion cache keys per cache tag as limited by Redis Set datatype. | ||
39 | * E.g. If you use a "all" items tag for expiry instead of clear(), that limits you to 4 billion cache items also. | ||
40 | * | ||
41 | * @see https://redis.io/topics/lru-cache#eviction-policies Documentation for Redis eviction policies. | ||
42 | * @see https://redis.io/topics/data-types#sets Documentation for Redis Set datatype. | ||
43 | * | ||
44 | * @author Nicolas Grekas <p@tchwork.com> | ||
45 | * @author André Rømcke <andre.romcke+symfony@gmail.com> | ||
46 | */ | ||
47 | class RedisTagAwareAdapter extends AbstractTagAwareAdapter | ||
48 | { | ||
49 | use RedisTrait; | ||
50 | |||
51 | /** | ||
52 | * On cache items without a lifetime set, we set it to 100 days. This is to make sure cache items are | ||
53 | * preferred to be evicted over tag Sets, if eviction policy is configured according to requirements. | ||
54 | */ | ||
55 | private const DEFAULT_CACHE_TTL = 8640000; | ||
56 | |||
57 | /** | ||
58 | * detected eviction policy used on Redis server. | ||
59 | */ | ||
60 | private string $redisEvictionPolicy; | ||
61 | |||
62 | public function __construct( | ||
63 | \Redis|Relay|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis, | ||
64 | private string $namespace = '', | ||
65 | int $defaultLifetime = 0, | ||
66 | ?MarshallerInterface $marshaller = null, | ||
67 | ) { | ||
68 | if ($redis instanceof \Predis\ClientInterface && $redis->getConnection() instanceof ClusterInterface && !$redis->getConnection() instanceof PredisCluster) { | ||
69 | throw new InvalidArgumentException(sprintf('Unsupported Predis cluster connection: only "%s" is, "%s" given.', PredisCluster::class, get_debug_type($redis->getConnection()))); | ||
70 | } | ||
71 | |||
72 | $isRelay = $redis instanceof Relay; | ||
73 | if ($isRelay || \defined('Redis::OPT_COMPRESSION') && \in_array($redis::class, [\Redis::class, \RedisArray::class, \RedisCluster::class], true)) { | ||
74 | $compression = $redis->getOption($isRelay ? Relay::OPT_COMPRESSION : \Redis::OPT_COMPRESSION); | ||
75 | |||
76 | foreach (\is_array($compression) ? $compression : [$compression] as $c) { | ||
77 | if ($isRelay ? Relay::COMPRESSION_NONE : \Redis::COMPRESSION_NONE !== $c) { | ||
78 | throw new InvalidArgumentException(sprintf('redis compression must be disabled when using "%s", use "%s" instead.', static::class, DeflateMarshaller::class)); | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | |||
83 | $this->init($redis, $namespace, $defaultLifetime, new TagAwareMarshaller($marshaller)); | ||
84 | } | ||
85 | |||
86 | protected function doSave(array $values, int $lifetime, array $addTagData = [], array $delTagData = []): array | ||
87 | { | ||
88 | $eviction = $this->getRedisEvictionPolicy(); | ||
89 | if ('noeviction' !== $eviction && !str_starts_with($eviction, 'volatile-')) { | ||
90 | throw new LogicException(sprintf('Redis maxmemory-policy setting "%s" is *not* supported by RedisTagAwareAdapter, use "noeviction" or "volatile-*" eviction policies.', $eviction)); | ||
91 | } | ||
92 | |||
93 | // serialize values | ||
94 | if (!$serialized = $this->marshaller->marshall($values, $failed)) { | ||
95 | return $failed; | ||
96 | } | ||
97 | |||
98 | // While pipeline isn't supported on RedisCluster, other setups will at least benefit from doing this in one op | ||
99 | $results = $this->pipeline(static function () use ($serialized, $lifetime, $addTagData, $delTagData, $failed) { | ||
100 | // Store cache items, force a ttl if none is set, as there is no MSETEX we need to set each one | ||
101 | foreach ($serialized as $id => $value) { | ||
102 | yield 'setEx' => [ | ||
103 | $id, | ||
104 | 0 >= $lifetime ? self::DEFAULT_CACHE_TTL : $lifetime, | ||
105 | $value, | ||
106 | ]; | ||
107 | } | ||
108 | |||
109 | // Add and Remove Tags | ||
110 | foreach ($addTagData as $tagId => $ids) { | ||
111 | if (!$failed || $ids = array_diff($ids, $failed)) { | ||
112 | yield 'sAdd' => array_merge([$tagId], $ids); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | foreach ($delTagData as $tagId => $ids) { | ||
117 | if (!$failed || $ids = array_diff($ids, $failed)) { | ||
118 | yield 'sRem' => array_merge([$tagId], $ids); | ||
119 | } | ||
120 | } | ||
121 | }); | ||
122 | |||
123 | foreach ($results as $id => $result) { | ||
124 | // Skip results of SADD/SREM operations, they'll be 1 or 0 depending on if set value already existed or not | ||
125 | if (is_numeric($result)) { | ||
126 | continue; | ||
127 | } | ||
128 | // setEx results | ||
129 | if (true !== $result && (!$result instanceof Status || Status::get('OK') !== $result)) { | ||
130 | $failed[] = $id; | ||
131 | } | ||
132 | } | ||
133 | |||
134 | return $failed; | ||
135 | } | ||
136 | |||
137 | protected function doDeleteYieldTags(array $ids): iterable | ||
138 | { | ||
139 | $lua = <<<'EOLUA' | ||
140 | local v = redis.call('GET', KEYS[1]) | ||
141 | local e = redis.pcall('UNLINK', KEYS[1]) | ||
142 | |||
143 | if type(e) ~= 'number' then | ||
144 | redis.call('DEL', KEYS[1]) | ||
145 | end | ||
146 | |||
147 | if not v or v:len() <= 13 or v:byte(1) ~= 0x9D or v:byte(6) ~= 0 or v:byte(10) ~= 0x5F then | ||
148 | return '' | ||
149 | end | ||
150 | |||
151 | return v:sub(14, 13 + v:byte(13) + v:byte(12) * 256 + v:byte(11) * 65536) | ||
152 | EOLUA; | ||
153 | |||
154 | $results = $this->pipeline(function () use ($ids, $lua) { | ||
155 | foreach ($ids as $id) { | ||
156 | yield 'eval' => $this->redis instanceof \Predis\ClientInterface ? [$lua, 1, $id] : [$lua, [$id], 1]; | ||
157 | } | ||
158 | }); | ||
159 | |||
160 | foreach ($results as $id => $result) { | ||
161 | if ($result instanceof \RedisException || $result instanceof \Relay\Exception || $result instanceof ErrorInterface) { | ||
162 | CacheItem::log($this->logger, 'Failed to delete key "{key}": '.$result->getMessage(), ['key' => substr($id, \strlen($this->namespace)), 'exception' => $result]); | ||
163 | |||
164 | continue; | ||
165 | } | ||
166 | |||
167 | try { | ||
168 | yield $id => !\is_string($result) || '' === $result ? [] : $this->marshaller->unmarshall($result); | ||
169 | } catch (\Exception) { | ||
170 | yield $id => []; | ||
171 | } | ||
172 | } | ||
173 | } | ||
174 | |||
175 | protected function doDeleteTagRelations(array $tagData): bool | ||
176 | { | ||
177 | $results = $this->pipeline(static function () use ($tagData) { | ||
178 | foreach ($tagData as $tagId => $idList) { | ||
179 | array_unshift($idList, $tagId); | ||
180 | yield 'sRem' => $idList; | ||
181 | } | ||
182 | }); | ||
183 | foreach ($results as $result) { | ||
184 | // no-op | ||
185 | } | ||
186 | |||
187 | return true; | ||
188 | } | ||
189 | |||
190 | protected function doInvalidate(array $tagIds): bool | ||
191 | { | ||
192 | // This script scans the set of items linked to tag: it empties the set | ||
193 | // and removes the linked items. When the set is still not empty after | ||
194 | // the scan, it means we're in cluster mode and that the linked items | ||
195 | // are on other nodes: we move the links to a temporary set and we | ||
196 | // garbage collect that set from the client side. | ||
197 | |||
198 | $lua = <<<'EOLUA' | ||
199 | redis.replicate_commands() | ||
200 | |||
201 | local cursor = '0' | ||
202 | local id = KEYS[1] | ||
203 | repeat | ||
204 | local result = redis.call('SSCAN', id, cursor, 'COUNT', 5000); | ||
205 | cursor = result[1]; | ||
206 | local rems = {} | ||
207 | |||
208 | for _, v in ipairs(result[2]) do | ||
209 | local ok, _ = pcall(redis.call, 'DEL', ARGV[1]..v) | ||
210 | if ok then | ||
211 | table.insert(rems, v) | ||
212 | end | ||
213 | end | ||
214 | if 0 < #rems then | ||
215 | redis.call('SREM', id, unpack(rems)) | ||
216 | end | ||
217 | until '0' == cursor; | ||
218 | |||
219 | redis.call('SUNIONSTORE', '{'..id..'}'..id, id) | ||
220 | redis.call('DEL', id) | ||
221 | |||
222 | return redis.call('SSCAN', '{'..id..'}'..id, '0', 'COUNT', 5000) | ||
223 | EOLUA; | ||
224 | |||
225 | $results = $this->pipeline(function () use ($tagIds, $lua) { | ||
226 | if ($this->redis instanceof \Predis\ClientInterface) { | ||
227 | $prefix = $this->redis->getOptions()->prefix ? $this->redis->getOptions()->prefix->getPrefix() : ''; | ||
228 | } elseif (\is_array($prefix = $this->redis->getOption($this->redis instanceof Relay ? Relay::OPT_PREFIX : \Redis::OPT_PREFIX) ?? '')) { | ||
229 | $prefix = current($prefix); | ||
230 | } | ||
231 | |||
232 | foreach ($tagIds as $id) { | ||
233 | yield 'eval' => $this->redis instanceof \Predis\ClientInterface ? [$lua, 1, $id, $prefix] : [$lua, [$id, $prefix], 1]; | ||
234 | } | ||
235 | }); | ||
236 | |||
237 | $lua = <<<'EOLUA' | ||
238 | redis.replicate_commands() | ||
239 | |||
240 | local id = KEYS[1] | ||
241 | local cursor = table.remove(ARGV) | ||
242 | redis.call('SREM', '{'..id..'}'..id, unpack(ARGV)) | ||
243 | |||
244 | return redis.call('SSCAN', '{'..id..'}'..id, cursor, 'COUNT', 5000) | ||
245 | EOLUA; | ||
246 | |||
247 | $success = true; | ||
248 | foreach ($results as $id => $values) { | ||
249 | if ($values instanceof \RedisException || $values instanceof \Relay\Exception || $values instanceof ErrorInterface) { | ||
250 | CacheItem::log($this->logger, 'Failed to invalidate key "{key}": '.$values->getMessage(), ['key' => substr($id, \strlen($this->namespace)), 'exception' => $values]); | ||
251 | $success = false; | ||
252 | |||
253 | continue; | ||
254 | } | ||
255 | |||
256 | [$cursor, $ids] = $values; | ||
257 | |||
258 | while ($ids || '0' !== $cursor) { | ||
259 | $this->doDelete($ids); | ||
260 | |||
261 | $evalArgs = [$id, $cursor]; | ||
262 | array_splice($evalArgs, 1, 0, $ids); | ||
263 | |||
264 | if ($this->redis instanceof \Predis\ClientInterface) { | ||
265 | array_unshift($evalArgs, $lua, 1); | ||
266 | } else { | ||
267 | $evalArgs = [$lua, $evalArgs, 1]; | ||
268 | } | ||
269 | |||
270 | $results = $this->pipeline(function () use ($evalArgs) { | ||
271 | yield 'eval' => $evalArgs; | ||
272 | }); | ||
273 | |||
274 | foreach ($results as [$cursor, $ids]) { | ||
275 | // no-op | ||
276 | } | ||
277 | } | ||
278 | } | ||
279 | |||
280 | return $success; | ||
281 | } | ||
282 | |||
283 | private function getRedisEvictionPolicy(): string | ||
284 | { | ||
285 | if (isset($this->redisEvictionPolicy)) { | ||
286 | return $this->redisEvictionPolicy; | ||
287 | } | ||
288 | |||
289 | $hosts = $this->getHosts(); | ||
290 | $host = reset($hosts); | ||
291 | if ($host instanceof \Predis\Client && $host->getConnection() instanceof ReplicationInterface) { | ||
292 | // Predis supports info command only on the master in replication environments | ||
293 | $hosts = [$host->getClientFor('master')]; | ||
294 | } | ||
295 | |||
296 | foreach ($hosts as $host) { | ||
297 | $info = $host->info('Memory'); | ||
298 | |||
299 | if (false === $info || null === $info || $info instanceof ErrorInterface) { | ||
300 | continue; | ||
301 | } | ||
302 | |||
303 | $info = $info['Memory'] ?? $info; | ||
304 | |||
305 | return $this->redisEvictionPolicy = $info['maxmemory_policy'] ?? ''; | ||
306 | } | ||
307 | |||
308 | return $this->redisEvictionPolicy = ''; | ||
309 | } | ||
310 | } | ||
diff --git a/vendor/symfony/cache/Adapter/TagAwareAdapter.php b/vendor/symfony/cache/Adapter/TagAwareAdapter.php new file mode 100644 index 0000000..34082db --- /dev/null +++ b/vendor/symfony/cache/Adapter/TagAwareAdapter.php | |||
@@ -0,0 +1,370 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Psr\Cache\CacheItemInterface; | ||
15 | use Psr\Cache\InvalidArgumentException; | ||
16 | use Psr\Log\LoggerAwareInterface; | ||
17 | use Psr\Log\LoggerAwareTrait; | ||
18 | use Symfony\Component\Cache\CacheItem; | ||
19 | use Symfony\Component\Cache\PruneableInterface; | ||
20 | use Symfony\Component\Cache\ResettableInterface; | ||
21 | use Symfony\Component\Cache\Traits\ContractsTrait; | ||
22 | use Symfony\Contracts\Cache\TagAwareCacheInterface; | ||
23 | |||
24 | /** | ||
25 | * Implements simple and robust tag-based invalidation suitable for use with volatile caches. | ||
26 | * | ||
27 | * This adapter works by storing a version for each tags. When saving an item, it is stored together with its tags and | ||
28 | * their corresponding versions. When retrieving an item, those tag versions are compared to the current version of | ||
29 | * each tags. Invalidation is achieved by deleting tags, thereby ensuring that their versions change even when the | ||
30 | * storage is out of space. When versions of non-existing tags are requested for item commits, this adapter assigns a | ||
31 | * new random version to them. | ||
32 | * | ||
33 | * @author Nicolas Grekas <p@tchwork.com> | ||
34 | * @author Sergey Belyshkin <sbelyshkin@gmail.com> | ||
35 | */ | ||
36 | class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterface, PruneableInterface, ResettableInterface, LoggerAwareInterface | ||
37 | { | ||
38 | use ContractsTrait; | ||
39 | use LoggerAwareTrait; | ||
40 | |||
41 | public const TAGS_PREFIX = "\1tags\1"; | ||
42 | |||
43 | private array $deferred = []; | ||
44 | private AdapterInterface $pool; | ||
45 | private AdapterInterface $tags; | ||
46 | private array $knownTagVersions = []; | ||
47 | |||
48 | private static \Closure $setCacheItemTags; | ||
49 | private static \Closure $setTagVersions; | ||
50 | private static \Closure $getTagsByKey; | ||
51 | private static \Closure $saveTags; | ||
52 | |||
53 | public function __construct( | ||
54 | AdapterInterface $itemsPool, | ||
55 | ?AdapterInterface $tagsPool = null, | ||
56 | private float $knownTagVersionsTtl = 0.15, | ||
57 | ) { | ||
58 | $this->pool = $itemsPool; | ||
59 | $this->tags = $tagsPool ?? $itemsPool; | ||
60 | self::$setCacheItemTags ??= \Closure::bind( | ||
61 | static function (array $items, array $itemTags) { | ||
62 | foreach ($items as $key => $item) { | ||
63 | $item->isTaggable = true; | ||
64 | |||
65 | if (isset($itemTags[$key])) { | ||
66 | $tags = array_keys($itemTags[$key]); | ||
67 | $item->metadata[CacheItem::METADATA_TAGS] = array_combine($tags, $tags); | ||
68 | } else { | ||
69 | $item->value = null; | ||
70 | $item->isHit = false; | ||
71 | $item->metadata = []; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | return $items; | ||
76 | }, | ||
77 | null, | ||
78 | CacheItem::class | ||
79 | ); | ||
80 | self::$setTagVersions ??= \Closure::bind( | ||
81 | static function (array $items, array $tagVersions) { | ||
82 | foreach ($items as $item) { | ||
83 | $item->newMetadata[CacheItem::METADATA_TAGS] = array_intersect_key($tagVersions, $item->newMetadata[CacheItem::METADATA_TAGS] ?? []); | ||
84 | } | ||
85 | }, | ||
86 | null, | ||
87 | CacheItem::class | ||
88 | ); | ||
89 | self::$getTagsByKey ??= \Closure::bind( | ||
90 | static function ($deferred) { | ||
91 | $tagsByKey = []; | ||
92 | foreach ($deferred as $key => $item) { | ||
93 | $tagsByKey[$key] = $item->newMetadata[CacheItem::METADATA_TAGS] ?? []; | ||
94 | $item->metadata = $item->newMetadata; | ||
95 | } | ||
96 | |||
97 | return $tagsByKey; | ||
98 | }, | ||
99 | null, | ||
100 | CacheItem::class | ||
101 | ); | ||
102 | self::$saveTags ??= \Closure::bind( | ||
103 | static function (AdapterInterface $tagsAdapter, array $tags) { | ||
104 | ksort($tags); | ||
105 | |||
106 | foreach ($tags as $v) { | ||
107 | $v->expiry = 0; | ||
108 | $tagsAdapter->saveDeferred($v); | ||
109 | } | ||
110 | |||
111 | return $tagsAdapter->commit(); | ||
112 | }, | ||
113 | null, | ||
114 | CacheItem::class | ||
115 | ); | ||
116 | } | ||
117 | |||
118 | public function invalidateTags(array $tags): bool | ||
119 | { | ||
120 | $ids = []; | ||
121 | foreach ($tags as $tag) { | ||
122 | \assert('' !== CacheItem::validateKey($tag)); | ||
123 | unset($this->knownTagVersions[$tag]); | ||
124 | $ids[] = $tag.static::TAGS_PREFIX; | ||
125 | } | ||
126 | |||
127 | return !$tags || $this->tags->deleteItems($ids); | ||
128 | } | ||
129 | |||
130 | public function hasItem(mixed $key): bool | ||
131 | { | ||
132 | return $this->getItem($key)->isHit(); | ||
133 | } | ||
134 | |||
135 | public function getItem(mixed $key): CacheItem | ||
136 | { | ||
137 | foreach ($this->getItems([$key]) as $item) { | ||
138 | return $item; | ||
139 | } | ||
140 | } | ||
141 | |||
142 | public function getItems(array $keys = []): iterable | ||
143 | { | ||
144 | $tagKeys = []; | ||
145 | $commit = false; | ||
146 | |||
147 | foreach ($keys as $key) { | ||
148 | if ('' !== $key && \is_string($key)) { | ||
149 | $commit = $commit || isset($this->deferred[$key]); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | if ($commit) { | ||
154 | $this->commit(); | ||
155 | } | ||
156 | |||
157 | try { | ||
158 | $items = $this->pool->getItems($keys); | ||
159 | } catch (InvalidArgumentException $e) { | ||
160 | $this->pool->getItems($keys); // Should throw an exception | ||
161 | |||
162 | throw $e; | ||
163 | } | ||
164 | |||
165 | $bufferedItems = $itemTags = []; | ||
166 | |||
167 | foreach ($items as $key => $item) { | ||
168 | if (null !== $tags = $item->getMetadata()[CacheItem::METADATA_TAGS] ?? null) { | ||
169 | $itemTags[$key] = $tags; | ||
170 | } | ||
171 | |||
172 | $bufferedItems[$key] = $item; | ||
173 | |||
174 | if (null === $tags) { | ||
175 | $key = "\0tags\0".$key; | ||
176 | $tagKeys[$key] = $key; // BC with pools populated before v6.1 | ||
177 | } | ||
178 | } | ||
179 | |||
180 | if ($tagKeys) { | ||
181 | foreach ($this->pool->getItems($tagKeys) as $key => $item) { | ||
182 | if ($item->isHit()) { | ||
183 | $itemTags[substr($key, \strlen("\0tags\0"))] = $item->get() ?: []; | ||
184 | } | ||
185 | } | ||
186 | } | ||
187 | |||
188 | $tagVersions = $this->getTagVersions($itemTags, false); | ||
189 | foreach ($itemTags as $key => $tags) { | ||
190 | foreach ($tags as $tag => $version) { | ||
191 | if ($tagVersions[$tag] !== $version) { | ||
192 | unset($itemTags[$key]); | ||
193 | continue 2; | ||
194 | } | ||
195 | } | ||
196 | } | ||
197 | $tagVersions = null; | ||
198 | |||
199 | return (self::$setCacheItemTags)($bufferedItems, $itemTags); | ||
200 | } | ||
201 | |||
202 | public function clear(string $prefix = ''): bool | ||
203 | { | ||
204 | if ('' !== $prefix) { | ||
205 | foreach ($this->deferred as $key => $item) { | ||
206 | if (str_starts_with($key, $prefix)) { | ||
207 | unset($this->deferred[$key]); | ||
208 | } | ||
209 | } | ||
210 | } else { | ||
211 | $this->deferred = []; | ||
212 | } | ||
213 | |||
214 | if ($this->pool instanceof AdapterInterface) { | ||
215 | return $this->pool->clear($prefix); | ||
216 | } | ||
217 | |||
218 | return $this->pool->clear(); | ||
219 | } | ||
220 | |||
221 | public function deleteItem(mixed $key): bool | ||
222 | { | ||
223 | return $this->deleteItems([$key]); | ||
224 | } | ||
225 | |||
226 | public function deleteItems(array $keys): bool | ||
227 | { | ||
228 | foreach ($keys as $key) { | ||
229 | if ('' !== $key && \is_string($key)) { | ||
230 | $keys[] = "\0tags\0".$key; // BC with pools populated before v6.1 | ||
231 | } | ||
232 | } | ||
233 | |||
234 | return $this->pool->deleteItems($keys); | ||
235 | } | ||
236 | |||
237 | public function save(CacheItemInterface $item): bool | ||
238 | { | ||
239 | if (!$item instanceof CacheItem) { | ||
240 | return false; | ||
241 | } | ||
242 | $this->deferred[$item->getKey()] = $item; | ||
243 | |||
244 | return $this->commit(); | ||
245 | } | ||
246 | |||
247 | public function saveDeferred(CacheItemInterface $item): bool | ||
248 | { | ||
249 | if (!$item instanceof CacheItem) { | ||
250 | return false; | ||
251 | } | ||
252 | $this->deferred[$item->getKey()] = $item; | ||
253 | |||
254 | return true; | ||
255 | } | ||
256 | |||
257 | public function commit(): bool | ||
258 | { | ||
259 | if (!$items = $this->deferred) { | ||
260 | return true; | ||
261 | } | ||
262 | |||
263 | $tagVersions = $this->getTagVersions((self::$getTagsByKey)($items), true); | ||
264 | (self::$setTagVersions)($items, $tagVersions); | ||
265 | |||
266 | $ok = true; | ||
267 | foreach ($items as $key => $item) { | ||
268 | if ($this->pool->saveDeferred($item)) { | ||
269 | unset($this->deferred[$key]); | ||
270 | } else { | ||
271 | $ok = false; | ||
272 | } | ||
273 | } | ||
274 | $ok = $this->pool->commit() && $ok; | ||
275 | |||
276 | $tagVersions = array_keys($tagVersions); | ||
277 | (self::$setTagVersions)($items, array_combine($tagVersions, $tagVersions)); | ||
278 | |||
279 | return $ok; | ||
280 | } | ||
281 | |||
282 | public function prune(): bool | ||
283 | { | ||
284 | return $this->pool instanceof PruneableInterface && $this->pool->prune(); | ||
285 | } | ||
286 | |||
287 | public function reset(): void | ||
288 | { | ||
289 | $this->commit(); | ||
290 | $this->knownTagVersions = []; | ||
291 | $this->pool instanceof ResettableInterface && $this->pool->reset(); | ||
292 | $this->tags instanceof ResettableInterface && $this->tags->reset(); | ||
293 | } | ||
294 | |||
295 | public function __sleep(): array | ||
296 | { | ||
297 | throw new \BadMethodCallException('Cannot serialize '.__CLASS__); | ||
298 | } | ||
299 | |||
300 | public function __wakeup(): void | ||
301 | { | ||
302 | throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); | ||
303 | } | ||
304 | |||
305 | public function __destruct() | ||
306 | { | ||
307 | $this->commit(); | ||
308 | } | ||
309 | |||
310 | private function getTagVersions(array $tagsByKey, bool $persistTags): array | ||
311 | { | ||
312 | $tagVersions = []; | ||
313 | $fetchTagVersions = $persistTags; | ||
314 | |||
315 | foreach ($tagsByKey as $tags) { | ||
316 | $tagVersions += $tags; | ||
317 | if ($fetchTagVersions) { | ||
318 | continue; | ||
319 | } | ||
320 | foreach ($tags as $tag => $version) { | ||
321 | if ($tagVersions[$tag] !== $version) { | ||
322 | $fetchTagVersions = true; | ||
323 | } | ||
324 | } | ||
325 | } | ||
326 | |||
327 | if (!$tagVersions) { | ||
328 | return []; | ||
329 | } | ||
330 | |||
331 | $now = microtime(true); | ||
332 | $tags = []; | ||
333 | foreach ($tagVersions as $tag => $version) { | ||
334 | $tags[$tag.static::TAGS_PREFIX] = $tag; | ||
335 | $knownTagVersion = $this->knownTagVersions[$tag] ?? [0, null]; | ||
336 | if ($fetchTagVersions || $now > $knownTagVersion[0] || $knownTagVersion[1] !== $version) { | ||
337 | // reuse previously fetched tag versions until the expiration | ||
338 | $fetchTagVersions = true; | ||
339 | } | ||
340 | } | ||
341 | |||
342 | if (!$fetchTagVersions) { | ||
343 | return $tagVersions; | ||
344 | } | ||
345 | |||
346 | $newTags = []; | ||
347 | $newVersion = null; | ||
348 | $expiration = $now + $this->knownTagVersionsTtl; | ||
349 | foreach ($this->tags->getItems(array_keys($tags)) as $tag => $version) { | ||
350 | unset($this->knownTagVersions[$tag = $tags[$tag]]); // update FIFO | ||
351 | if (null !== $tagVersions[$tag] = $version->get()) { | ||
352 | $this->knownTagVersions[$tag] = [$expiration, $tagVersions[$tag]]; | ||
353 | } elseif ($persistTags) { | ||
354 | $newTags[$tag] = $version->set($newVersion ??= random_bytes(6)); | ||
355 | $tagVersions[$tag] = $newVersion; | ||
356 | $this->knownTagVersions[$tag] = [$expiration, $newVersion]; | ||
357 | } | ||
358 | } | ||
359 | |||
360 | if ($newTags) { | ||
361 | (self::$saveTags)($this->tags, $newTags); | ||
362 | } | ||
363 | |||
364 | while ($now > ($this->knownTagVersions[$tag = array_key_first($this->knownTagVersions)][0] ?? \INF)) { | ||
365 | unset($this->knownTagVersions[$tag]); | ||
366 | } | ||
367 | |||
368 | return $tagVersions; | ||
369 | } | ||
370 | } | ||
diff --git a/vendor/symfony/cache/Adapter/TagAwareAdapterInterface.php b/vendor/symfony/cache/Adapter/TagAwareAdapterInterface.php new file mode 100644 index 0000000..9242779 --- /dev/null +++ b/vendor/symfony/cache/Adapter/TagAwareAdapterInterface.php | |||
@@ -0,0 +1,31 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Psr\Cache\InvalidArgumentException; | ||
15 | |||
16 | /** | ||
17 | * Interface for invalidating cached items using tags. | ||
18 | * | ||
19 | * @author Nicolas Grekas <p@tchwork.com> | ||
20 | */ | ||
21 | interface TagAwareAdapterInterface extends AdapterInterface | ||
22 | { | ||
23 | /** | ||
24 | * Invalidates cached items using tags. | ||
25 | * | ||
26 | * @param string[] $tags An array of tags to invalidate | ||
27 | * | ||
28 | * @throws InvalidArgumentException When $tags is not valid | ||
29 | */ | ||
30 | public function invalidateTags(array $tags): bool; | ||
31 | } | ||
diff --git a/vendor/symfony/cache/Adapter/TraceableAdapter.php b/vendor/symfony/cache/Adapter/TraceableAdapter.php new file mode 100644 index 0000000..b5bce14 --- /dev/null +++ b/vendor/symfony/cache/Adapter/TraceableAdapter.php | |||
@@ -0,0 +1,250 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Psr\Cache\CacheItemInterface; | ||
15 | use Symfony\Component\Cache\CacheItem; | ||
16 | use Symfony\Component\Cache\PruneableInterface; | ||
17 | use Symfony\Component\Cache\ResettableInterface; | ||
18 | use Symfony\Contracts\Cache\CacheInterface; | ||
19 | use Symfony\Contracts\Service\ResetInterface; | ||
20 | |||
21 | /** | ||
22 | * An adapter that collects data about all cache calls. | ||
23 | * | ||
24 | * @author Aaron Scherer <aequasi@gmail.com> | ||
25 | * @author Tobias Nyholm <tobias.nyholm@gmail.com> | ||
26 | * @author Nicolas Grekas <p@tchwork.com> | ||
27 | */ | ||
28 | class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInterface, ResettableInterface | ||
29 | { | ||
30 | protected AdapterInterface $pool; | ||
31 | private array $calls = []; | ||
32 | |||
33 | public function __construct(AdapterInterface $pool) | ||
34 | { | ||
35 | $this->pool = $pool; | ||
36 | } | ||
37 | |||
38 | public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed | ||
39 | { | ||
40 | if (!$this->pool instanceof CacheInterface) { | ||
41 | throw new \BadMethodCallException(sprintf('Cannot call "%s::get()": this class doesn\'t implement "%s".', get_debug_type($this->pool), CacheInterface::class)); | ||
42 | } | ||
43 | |||
44 | $isHit = true; | ||
45 | $callback = function (CacheItem $item, bool &$save) use ($callback, &$isHit) { | ||
46 | $isHit = $item->isHit(); | ||
47 | |||
48 | return $callback($item, $save); | ||
49 | }; | ||
50 | |||
51 | $event = $this->start(__FUNCTION__); | ||
52 | try { | ||
53 | $value = $this->pool->get($key, $callback, $beta, $metadata); | ||
54 | $event->result[$key] = get_debug_type($value); | ||
55 | } finally { | ||
56 | $event->end = microtime(true); | ||
57 | } | ||
58 | if ($isHit) { | ||
59 | ++$event->hits; | ||
60 | } else { | ||
61 | ++$event->misses; | ||
62 | } | ||
63 | |||
64 | return $value; | ||
65 | } | ||
66 | |||
67 | public function getItem(mixed $key): CacheItem | ||
68 | { | ||
69 | $event = $this->start(__FUNCTION__); | ||
70 | try { | ||
71 | $item = $this->pool->getItem($key); | ||
72 | } finally { | ||
73 | $event->end = microtime(true); | ||
74 | } | ||
75 | if ($event->result[$key] = $item->isHit()) { | ||
76 | ++$event->hits; | ||
77 | } else { | ||
78 | ++$event->misses; | ||
79 | } | ||
80 | |||
81 | return $item; | ||
82 | } | ||
83 | |||
84 | public function hasItem(mixed $key): bool | ||
85 | { | ||
86 | $event = $this->start(__FUNCTION__); | ||
87 | try { | ||
88 | return $event->result[$key] = $this->pool->hasItem($key); | ||
89 | } finally { | ||
90 | $event->end = microtime(true); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | public function deleteItem(mixed $key): bool | ||
95 | { | ||
96 | $event = $this->start(__FUNCTION__); | ||
97 | try { | ||
98 | return $event->result[$key] = $this->pool->deleteItem($key); | ||
99 | } finally { | ||
100 | $event->end = microtime(true); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | public function save(CacheItemInterface $item): bool | ||
105 | { | ||
106 | $event = $this->start(__FUNCTION__); | ||
107 | try { | ||
108 | return $event->result[$item->getKey()] = $this->pool->save($item); | ||
109 | } finally { | ||
110 | $event->end = microtime(true); | ||
111 | } | ||
112 | } | ||
113 | |||
114 | public function saveDeferred(CacheItemInterface $item): bool | ||
115 | { | ||
116 | $event = $this->start(__FUNCTION__); | ||
117 | try { | ||
118 | return $event->result[$item->getKey()] = $this->pool->saveDeferred($item); | ||
119 | } finally { | ||
120 | $event->end = microtime(true); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | public function getItems(array $keys = []): iterable | ||
125 | { | ||
126 | $event = $this->start(__FUNCTION__); | ||
127 | try { | ||
128 | $result = $this->pool->getItems($keys); | ||
129 | } finally { | ||
130 | $event->end = microtime(true); | ||
131 | } | ||
132 | $f = function () use ($result, $event) { | ||
133 | $event->result = []; | ||
134 | foreach ($result as $key => $item) { | ||
135 | if ($event->result[$key] = $item->isHit()) { | ||
136 | ++$event->hits; | ||
137 | } else { | ||
138 | ++$event->misses; | ||
139 | } | ||
140 | yield $key => $item; | ||
141 | } | ||
142 | }; | ||
143 | |||
144 | return $f(); | ||
145 | } | ||
146 | |||
147 | public function clear(string $prefix = ''): bool | ||
148 | { | ||
149 | $event = $this->start(__FUNCTION__); | ||
150 | try { | ||
151 | if ($this->pool instanceof AdapterInterface) { | ||
152 | return $event->result = $this->pool->clear($prefix); | ||
153 | } | ||
154 | |||
155 | return $event->result = $this->pool->clear(); | ||
156 | } finally { | ||
157 | $event->end = microtime(true); | ||
158 | } | ||
159 | } | ||
160 | |||
161 | public function deleteItems(array $keys): bool | ||
162 | { | ||
163 | $event = $this->start(__FUNCTION__); | ||
164 | $event->result['keys'] = $keys; | ||
165 | try { | ||
166 | return $event->result['result'] = $this->pool->deleteItems($keys); | ||
167 | } finally { | ||
168 | $event->end = microtime(true); | ||
169 | } | ||
170 | } | ||
171 | |||
172 | public function commit(): bool | ||
173 | { | ||
174 | $event = $this->start(__FUNCTION__); | ||
175 | try { | ||
176 | return $event->result = $this->pool->commit(); | ||
177 | } finally { | ||
178 | $event->end = microtime(true); | ||
179 | } | ||
180 | } | ||
181 | |||
182 | public function prune(): bool | ||
183 | { | ||
184 | if (!$this->pool instanceof PruneableInterface) { | ||
185 | return false; | ||
186 | } | ||
187 | $event = $this->start(__FUNCTION__); | ||
188 | try { | ||
189 | return $event->result = $this->pool->prune(); | ||
190 | } finally { | ||
191 | $event->end = microtime(true); | ||
192 | } | ||
193 | } | ||
194 | |||
195 | public function reset(): void | ||
196 | { | ||
197 | if ($this->pool instanceof ResetInterface) { | ||
198 | $this->pool->reset(); | ||
199 | } | ||
200 | |||
201 | $this->clearCalls(); | ||
202 | } | ||
203 | |||
204 | public function delete(string $key): bool | ||
205 | { | ||
206 | $event = $this->start(__FUNCTION__); | ||
207 | try { | ||
208 | return $event->result[$key] = $this->pool->deleteItem($key); | ||
209 | } finally { | ||
210 | $event->end = microtime(true); | ||
211 | } | ||
212 | } | ||
213 | |||
214 | public function getCalls(): array | ||
215 | { | ||
216 | return $this->calls; | ||
217 | } | ||
218 | |||
219 | public function clearCalls(): void | ||
220 | { | ||
221 | $this->calls = []; | ||
222 | } | ||
223 | |||
224 | public function getPool(): AdapterInterface | ||
225 | { | ||
226 | return $this->pool; | ||
227 | } | ||
228 | |||
229 | protected function start(string $name): TraceableAdapterEvent | ||
230 | { | ||
231 | $this->calls[] = $event = new TraceableAdapterEvent(); | ||
232 | $event->name = $name; | ||
233 | $event->start = microtime(true); | ||
234 | |||
235 | return $event; | ||
236 | } | ||
237 | } | ||
238 | |||
239 | /** | ||
240 | * @internal | ||
241 | */ | ||
242 | class TraceableAdapterEvent | ||
243 | { | ||
244 | public string $name; | ||
245 | public float $start; | ||
246 | public float $end; | ||
247 | public array|bool $result; | ||
248 | public int $hits = 0; | ||
249 | public int $misses = 0; | ||
250 | } | ||
diff --git a/vendor/symfony/cache/Adapter/TraceableTagAwareAdapter.php b/vendor/symfony/cache/Adapter/TraceableTagAwareAdapter.php new file mode 100644 index 0000000..c85d199 --- /dev/null +++ b/vendor/symfony/cache/Adapter/TraceableTagAwareAdapter.php | |||
@@ -0,0 +1,35 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Adapter; | ||
13 | |||
14 | use Symfony\Contracts\Cache\TagAwareCacheInterface; | ||
15 | |||
16 | /** | ||
17 | * @author Robin Chalas <robin.chalas@gmail.com> | ||
18 | */ | ||
19 | class TraceableTagAwareAdapter extends TraceableAdapter implements TagAwareAdapterInterface, TagAwareCacheInterface | ||
20 | { | ||
21 | public function __construct(TagAwareAdapterInterface $pool) | ||
22 | { | ||
23 | parent::__construct($pool); | ||
24 | } | ||
25 | |||
26 | public function invalidateTags(array $tags): bool | ||
27 | { | ||
28 | $event = $this->start(__FUNCTION__); | ||
29 | try { | ||
30 | return $event->result = $this->pool->invalidateTags($tags); | ||
31 | } finally { | ||
32 | $event->end = microtime(true); | ||
33 | } | ||
34 | } | ||
35 | } | ||
diff --git a/vendor/symfony/cache/CHANGELOG.md b/vendor/symfony/cache/CHANGELOG.md new file mode 100644 index 0000000..cab9bf6 --- /dev/null +++ b/vendor/symfony/cache/CHANGELOG.md | |||
@@ -0,0 +1,147 @@ | |||
1 | CHANGELOG | ||
2 | ========= | ||
3 | |||
4 | 7.1 | ||
5 | --- | ||
6 | |||
7 | * Add option `sentinel_master` as an alias for `redis_sentinel` | ||
8 | * Deprecate `CouchbaseBucketAdapter`, use `CouchbaseCollectionAdapter` | ||
9 | * Add support for URL encoded characters in Couchbase DSN | ||
10 | * Add support for using DSN with PDOAdapter | ||
11 | * The algorithm for the default cache namespace changed from SHA256 to XXH128 | ||
12 | |||
13 | 7.0 | ||
14 | --- | ||
15 | |||
16 | * Add parameter `$isSameDatabase` to `DoctrineDbalAdapter::configureSchema()` | ||
17 | * Drop support for Postgres < 9.5 and SQL Server < 2008 in `DoctrineDbalAdapter` | ||
18 | |||
19 | 6.4 | ||
20 | --- | ||
21 | |||
22 | * `EarlyExpirationHandler` no longer implements `MessageHandlerInterface`, rely on `AsMessageHandler` instead | ||
23 | |||
24 | 6.3 | ||
25 | --- | ||
26 | |||
27 | * Add support for Relay PHP extension for Redis | ||
28 | * Updates to allow Redis cluster connections using predis/predis:^2.0 | ||
29 | * Add optional parameter `$isSameDatabase` to `DoctrineDbalAdapter::configureSchema()` | ||
30 | |||
31 | 6.1 | ||
32 | --- | ||
33 | |||
34 | * Add support for ACL auth in RedisAdapter | ||
35 | * Improve reliability and performance of `TagAwareAdapter` by making tag versions an integral part of item value | ||
36 | |||
37 | 6.0 | ||
38 | --- | ||
39 | |||
40 | * Remove `DoctrineProvider` and `DoctrineAdapter` | ||
41 | * Remove support of Doctrine DBAL in `PdoAdapter` | ||
42 | |||
43 | 5.4 | ||
44 | --- | ||
45 | |||
46 | * Deprecate `DoctrineProvider` and `DoctrineAdapter` because these classes have been added to the `doctrine/cache` package | ||
47 | * Add `DoctrineDbalAdapter` identical to `PdoAdapter` for `Doctrine\DBAL\Connection` or DBAL URL | ||
48 | * Deprecate usage of `PdoAdapter` with `Doctrine\DBAL\Connection` or DBAL URL | ||
49 | |||
50 | 5.3 | ||
51 | --- | ||
52 | |||
53 | * added support for connecting to Redis Sentinel clusters when using the Redis PHP extension | ||
54 | * add support for a custom serializer to the `ApcuAdapter` class | ||
55 | |||
56 | 5.2.0 | ||
57 | ----- | ||
58 | |||
59 | * added integration with Messenger to allow computing cached values in a worker | ||
60 | * allow ISO 8601 time intervals to specify default lifetime | ||
61 | |||
62 | 5.1.0 | ||
63 | ----- | ||
64 | |||
65 | * added max-items + LRU + max-lifetime capabilities to `ArrayCache` | ||
66 | * added `CouchbaseBucketAdapter` | ||
67 | * added context `cache-adapter` to log messages | ||
68 | |||
69 | 5.0.0 | ||
70 | ----- | ||
71 | |||
72 | * removed all PSR-16 implementations in the `Simple` namespace | ||
73 | * removed `SimpleCacheAdapter` | ||
74 | * removed `AbstractAdapter::unserialize()` | ||
75 | * removed `CacheItem::getPreviousTags()` | ||
76 | |||
77 | 4.4.0 | ||
78 | ----- | ||
79 | |||
80 | * added support for connecting to Redis Sentinel clusters | ||
81 | * added argument `$prefix` to `AdapterInterface::clear()` | ||
82 | * improved `RedisTagAwareAdapter` to support Redis server >= 2.8 and up to 4B items per tag | ||
83 | * added `TagAwareMarshaller` for optimized data storage when using `AbstractTagAwareAdapter` | ||
84 | * added `DeflateMarshaller` to compress serialized values | ||
85 | * removed support for phpredis 4 `compression` | ||
86 | * [BC BREAK] `RedisTagAwareAdapter` is not compatible with `RedisCluster` from `Predis` anymore, use `phpredis` instead | ||
87 | * Marked the `CacheDataCollector` class as `@final`. | ||
88 | * added `SodiumMarshaller` to encrypt/decrypt values using libsodium | ||
89 | |||
90 | 4.3.0 | ||
91 | ----- | ||
92 | |||
93 | * removed `psr/simple-cache` dependency, run `composer require psr/simple-cache` if you need it | ||
94 | * deprecated all PSR-16 adapters, use `Psr16Cache` or `Symfony\Contracts\Cache\CacheInterface` implementations instead | ||
95 | * deprecated `SimpleCacheAdapter`, use `Psr16Adapter` instead | ||
96 | |||
97 | 4.2.0 | ||
98 | ----- | ||
99 | |||
100 | * added support for connecting to Redis clusters via DSN | ||
101 | * added support for configuring multiple Memcached servers via DSN | ||
102 | * added `MarshallerInterface` and `DefaultMarshaller` to allow changing the serializer and provide one that automatically uses igbinary when available | ||
103 | * implemented `CacheInterface`, which provides stampede protection via probabilistic early expiration and should become the preferred way to use a cache | ||
104 | * added sub-second expiry accuracy for backends that support it | ||
105 | * added support for phpredis 4 `compression` and `tcp_keepalive` options | ||
106 | * added automatic table creation when using Doctrine DBAL with PDO-based backends | ||
107 | * throw `LogicException` when `CacheItem::tag()` is called on an item coming from a non tag-aware pool | ||
108 | * deprecated `CacheItem::getPreviousTags()`, use `CacheItem::getMetadata()` instead | ||
109 | * deprecated the `AbstractAdapter::unserialize()` and `AbstractCache::unserialize()` methods | ||
110 | * added `CacheCollectorPass` (originally in `FrameworkBundle`) | ||
111 | * added `CachePoolClearerPass` (originally in `FrameworkBundle`) | ||
112 | * added `CachePoolPass` (originally in `FrameworkBundle`) | ||
113 | * added `CachePoolPrunerPass` (originally in `FrameworkBundle`) | ||
114 | |||
115 | 3.4.0 | ||
116 | ----- | ||
117 | |||
118 | * added using options from Memcached DSN | ||
119 | * added PruneableInterface so PSR-6 or PSR-16 cache implementations can declare support for manual stale cache pruning | ||
120 | * added prune logic to FilesystemTrait, PhpFilesTrait, PdoTrait, TagAwareAdapter and ChainTrait | ||
121 | * now FilesystemAdapter, PhpFilesAdapter, FilesystemCache, PhpFilesCache, PdoAdapter, PdoCache, ChainAdapter, and | ||
122 | ChainCache implement PruneableInterface and support manual stale cache pruning | ||
123 | |||
124 | 3.3.0 | ||
125 | ----- | ||
126 | |||
127 | * added CacheItem::getPreviousTags() to get bound tags coming from the pool storage if any | ||
128 | * added PSR-16 "Simple Cache" implementations for all existing PSR-6 adapters | ||
129 | * added Psr6Cache and SimpleCacheAdapter for bidirectional interoperability between PSR-6 and PSR-16 | ||
130 | * added MemcachedAdapter (PSR-6) and MemcachedCache (PSR-16) | ||
131 | * added TraceableAdapter (PSR-6) and TraceableCache (PSR-16) | ||
132 | |||
133 | 3.2.0 | ||
134 | ----- | ||
135 | |||
136 | * added TagAwareAdapter for tags-based invalidation | ||
137 | * added PdoAdapter with PDO and Doctrine DBAL support | ||
138 | * added PhpArrayAdapter and PhpFilesAdapter for OPcache-backed shared memory storage (PHP 7+ only) | ||
139 | * added NullAdapter | ||
140 | |||
141 | 3.1.0 | ||
142 | ----- | ||
143 | |||
144 | * added the component with strict PSR-6 implementations | ||
145 | * added ApcuAdapter, ArrayAdapter, FilesystemAdapter and RedisAdapter | ||
146 | * added AbstractAdapter, ChainAdapter and ProxyAdapter | ||
147 | * added DoctrineAdapter and DoctrineProvider for bidirectional interoperability with Doctrine Cache | ||
diff --git a/vendor/symfony/cache/CacheItem.php b/vendor/symfony/cache/CacheItem.php new file mode 100644 index 0000000..1a81706 --- /dev/null +++ b/vendor/symfony/cache/CacheItem.php | |||
@@ -0,0 +1,198 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache; | ||
13 | |||
14 | use Psr\Log\LoggerInterface; | ||
15 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
16 | use Symfony\Component\Cache\Exception\LogicException; | ||
17 | use Symfony\Contracts\Cache\ItemInterface; | ||
18 | |||
19 | /** | ||
20 | * @author Nicolas Grekas <p@tchwork.com> | ||
21 | */ | ||
22 | final class CacheItem implements ItemInterface | ||
23 | { | ||
24 | private const METADATA_EXPIRY_OFFSET = 1527506807; | ||
25 | private const VALUE_WRAPPER = "\xA9"; | ||
26 | |||
27 | protected string $key; | ||
28 | protected mixed $value = null; | ||
29 | protected bool $isHit = false; | ||
30 | protected float|int|null $expiry = null; | ||
31 | protected array $metadata = []; | ||
32 | protected array $newMetadata = []; | ||
33 | protected ?ItemInterface $innerItem = null; | ||
34 | protected ?string $poolHash = null; | ||
35 | protected bool $isTaggable = false; | ||
36 | |||
37 | public function getKey(): string | ||
38 | { | ||
39 | return $this->key; | ||
40 | } | ||
41 | |||
42 | public function get(): mixed | ||
43 | { | ||
44 | return $this->value; | ||
45 | } | ||
46 | |||
47 | public function isHit(): bool | ||
48 | { | ||
49 | return $this->isHit; | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * @return $this | ||
54 | */ | ||
55 | public function set($value): static | ||
56 | { | ||
57 | $this->value = $value; | ||
58 | |||
59 | return $this; | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * @return $this | ||
64 | */ | ||
65 | public function expiresAt(?\DateTimeInterface $expiration): static | ||
66 | { | ||
67 | $this->expiry = null !== $expiration ? (float) $expiration->format('U.u') : null; | ||
68 | |||
69 | return $this; | ||
70 | } | ||
71 | |||
72 | /** | ||
73 | * @return $this | ||
74 | */ | ||
75 | public function expiresAfter(mixed $time): static | ||
76 | { | ||
77 | if (null === $time) { | ||
78 | $this->expiry = null; | ||
79 | } elseif ($time instanceof \DateInterval) { | ||
80 | $this->expiry = microtime(true) + \DateTimeImmutable::createFromFormat('U', 0)->add($time)->format('U.u'); | ||
81 | } elseif (\is_int($time)) { | ||
82 | $this->expiry = $time + microtime(true); | ||
83 | } else { | ||
84 | throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given.', get_debug_type($time))); | ||
85 | } | ||
86 | |||
87 | return $this; | ||
88 | } | ||
89 | |||
90 | public function tag(mixed $tags): static | ||
91 | { | ||
92 | if (!$this->isTaggable) { | ||
93 | throw new LogicException(sprintf('Cache item "%s" comes from a non tag-aware pool: you cannot tag it.', $this->key)); | ||
94 | } | ||
95 | if (!\is_array($tags) && !$tags instanceof \Traversable) { // don't use is_iterable(), it's slow | ||
96 | $tags = [$tags]; | ||
97 | } | ||
98 | foreach ($tags as $tag) { | ||
99 | if (!\is_string($tag) && !$tag instanceof \Stringable) { | ||
100 | throw new InvalidArgumentException(sprintf('Cache tag must be string or object that implements __toString(), "%s" given.', get_debug_type($tag))); | ||
101 | } | ||
102 | $tag = (string) $tag; | ||
103 | if (isset($this->newMetadata[self::METADATA_TAGS][$tag])) { | ||
104 | continue; | ||
105 | } | ||
106 | if ('' === $tag) { | ||
107 | throw new InvalidArgumentException('Cache tag length must be greater than zero.'); | ||
108 | } | ||
109 | if (false !== strpbrk($tag, self::RESERVED_CHARACTERS)) { | ||
110 | throw new InvalidArgumentException(sprintf('Cache tag "%s" contains reserved characters "%s".', $tag, self::RESERVED_CHARACTERS)); | ||
111 | } | ||
112 | $this->newMetadata[self::METADATA_TAGS][$tag] = $tag; | ||
113 | } | ||
114 | |||
115 | return $this; | ||
116 | } | ||
117 | |||
118 | public function getMetadata(): array | ||
119 | { | ||
120 | return $this->metadata; | ||
121 | } | ||
122 | |||
123 | /** | ||
124 | * Validates a cache key according to PSR-6. | ||
125 | * | ||
126 | * @param mixed $key The key to validate | ||
127 | * | ||
128 | * @throws InvalidArgumentException When $key is not valid | ||
129 | */ | ||
130 | public static function validateKey($key): string | ||
131 | { | ||
132 | if (!\is_string($key)) { | ||
133 | throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given.', get_debug_type($key))); | ||
134 | } | ||
135 | if ('' === $key) { | ||
136 | throw new InvalidArgumentException('Cache key length must be greater than zero.'); | ||
137 | } | ||
138 | if (false !== strpbrk($key, self::RESERVED_CHARACTERS)) { | ||
139 | throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters "%s".', $key, self::RESERVED_CHARACTERS)); | ||
140 | } | ||
141 | |||
142 | return $key; | ||
143 | } | ||
144 | |||
145 | /** | ||
146 | * Internal logging helper. | ||
147 | * | ||
148 | * @internal | ||
149 | */ | ||
150 | public static function log(?LoggerInterface $logger, string $message, array $context = []): void | ||
151 | { | ||
152 | if ($logger) { | ||
153 | $logger->warning($message, $context); | ||
154 | } else { | ||
155 | $replace = []; | ||
156 | foreach ($context as $k => $v) { | ||
157 | if (\is_scalar($v)) { | ||
158 | $replace['{'.$k.'}'] = $v; | ||
159 | } | ||
160 | } | ||
161 | @trigger_error(strtr($message, $replace), \E_USER_WARNING); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | private function pack(): mixed | ||
166 | { | ||
167 | if (!$m = $this->newMetadata) { | ||
168 | return $this->value; | ||
169 | } | ||
170 | $valueWrapper = self::VALUE_WRAPPER; | ||
171 | |||
172 | return new $valueWrapper($this->value, $m + ['expiry' => $this->expiry]); | ||
173 | } | ||
174 | |||
175 | private function unpack(): bool | ||
176 | { | ||
177 | $v = $this->value; | ||
178 | $valueWrapper = self::VALUE_WRAPPER; | ||
179 | |||
180 | if ($v instanceof $valueWrapper) { | ||
181 | $this->value = $v->value; | ||
182 | $this->metadata = $v->metadata; | ||
183 | |||
184 | return true; | ||
185 | } | ||
186 | |||
187 | if (!\is_array($v) || 1 !== \count($v) || 10 !== \strlen($k = (string) array_key_first($v)) || "\x9D" !== $k[0] || "\0" !== $k[5] || "\x5F" !== $k[9]) { | ||
188 | return false; | ||
189 | } | ||
190 | |||
191 | // BC with pools populated before v6.1 | ||
192 | $this->value = $v[$k]; | ||
193 | $this->metadata = unpack('Vexpiry/Nctime', substr($k, 1, -1)); | ||
194 | $this->metadata['expiry'] += self::METADATA_EXPIRY_OFFSET; | ||
195 | |||
196 | return true; | ||
197 | } | ||
198 | } | ||
diff --git a/vendor/symfony/cache/DataCollector/CacheDataCollector.php b/vendor/symfony/cache/DataCollector/CacheDataCollector.php new file mode 100644 index 0000000..b9bcdaf --- /dev/null +++ b/vendor/symfony/cache/DataCollector/CacheDataCollector.php | |||
@@ -0,0 +1,184 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\DataCollector; | ||
13 | |||
14 | use Symfony\Component\Cache\Adapter\TraceableAdapter; | ||
15 | use Symfony\Component\Cache\Adapter\TraceableAdapterEvent; | ||
16 | use Symfony\Component\HttpFoundation\Request; | ||
17 | use Symfony\Component\HttpFoundation\Response; | ||
18 | use Symfony\Component\HttpKernel\DataCollector\DataCollector; | ||
19 | use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; | ||
20 | |||
21 | /** | ||
22 | * @author Aaron Scherer <aequasi@gmail.com> | ||
23 | * @author Tobias Nyholm <tobias.nyholm@gmail.com> | ||
24 | * | ||
25 | * @final | ||
26 | */ | ||
27 | class CacheDataCollector extends DataCollector implements LateDataCollectorInterface | ||
28 | { | ||
29 | /** | ||
30 | * @var TraceableAdapter[] | ||
31 | */ | ||
32 | private array $instances = []; | ||
33 | |||
34 | public function addInstance(string $name, TraceableAdapter $instance): void | ||
35 | { | ||
36 | $this->instances[$name] = $instance; | ||
37 | } | ||
38 | |||
39 | public function collect(Request $request, Response $response, ?\Throwable $exception = null): void | ||
40 | { | ||
41 | $empty = ['calls' => [], 'adapters' => [], 'config' => [], 'options' => [], 'statistics' => []]; | ||
42 | $this->data = ['instances' => $empty, 'total' => $empty]; | ||
43 | foreach ($this->instances as $name => $instance) { | ||
44 | $this->data['instances']['calls'][$name] = $instance->getCalls(); | ||
45 | $this->data['instances']['adapters'][$name] = get_debug_type($instance->getPool()); | ||
46 | } | ||
47 | |||
48 | $this->data['instances']['statistics'] = $this->calculateStatistics(); | ||
49 | $this->data['total']['statistics'] = $this->calculateTotalStatistics(); | ||
50 | } | ||
51 | |||
52 | public function reset(): void | ||
53 | { | ||
54 | $this->data = []; | ||
55 | foreach ($this->instances as $instance) { | ||
56 | $instance->clearCalls(); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | public function lateCollect(): void | ||
61 | { | ||
62 | $this->data['instances']['calls'] = $this->cloneVar($this->data['instances']['calls']); | ||
63 | } | ||
64 | |||
65 | public function getName(): string | ||
66 | { | ||
67 | return 'cache'; | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * Method returns amount of logged Cache reads: "get" calls. | ||
72 | */ | ||
73 | public function getStatistics(): array | ||
74 | { | ||
75 | return $this->data['instances']['statistics']; | ||
76 | } | ||
77 | |||
78 | /** | ||
79 | * Method returns the statistic totals. | ||
80 | */ | ||
81 | public function getTotals(): array | ||
82 | { | ||
83 | return $this->data['total']['statistics']; | ||
84 | } | ||
85 | |||
86 | /** | ||
87 | * Method returns all logged Cache call objects. | ||
88 | */ | ||
89 | public function getCalls(): mixed | ||
90 | { | ||
91 | return $this->data['instances']['calls']; | ||
92 | } | ||
93 | |||
94 | /** | ||
95 | * Method returns all logged Cache adapter classes. | ||
96 | */ | ||
97 | public function getAdapters(): array | ||
98 | { | ||
99 | return $this->data['instances']['adapters']; | ||
100 | } | ||
101 | |||
102 | private function calculateStatistics(): array | ||
103 | { | ||
104 | $statistics = []; | ||
105 | foreach ($this->data['instances']['calls'] as $name => $calls) { | ||
106 | $statistics[$name] = [ | ||
107 | 'calls' => 0, | ||
108 | 'time' => 0, | ||
109 | 'reads' => 0, | ||
110 | 'writes' => 0, | ||
111 | 'deletes' => 0, | ||
112 | 'hits' => 0, | ||
113 | 'misses' => 0, | ||
114 | ]; | ||
115 | /** @var TraceableAdapterEvent $call */ | ||
116 | foreach ($calls as $call) { | ||
117 | ++$statistics[$name]['calls']; | ||
118 | $statistics[$name]['time'] += ($call->end ?? microtime(true)) - $call->start; | ||
119 | if ('get' === $call->name) { | ||
120 | ++$statistics[$name]['reads']; | ||
121 | if ($call->hits) { | ||
122 | ++$statistics[$name]['hits']; | ||
123 | } else { | ||
124 | ++$statistics[$name]['misses']; | ||
125 | ++$statistics[$name]['writes']; | ||
126 | } | ||
127 | } elseif ('getItem' === $call->name) { | ||
128 | ++$statistics[$name]['reads']; | ||
129 | if ($call->hits) { | ||
130 | ++$statistics[$name]['hits']; | ||
131 | } else { | ||
132 | ++$statistics[$name]['misses']; | ||
133 | } | ||
134 | } elseif ('getItems' === $call->name) { | ||
135 | $statistics[$name]['reads'] += $call->hits + $call->misses; | ||
136 | $statistics[$name]['hits'] += $call->hits; | ||
137 | $statistics[$name]['misses'] += $call->misses; | ||
138 | } elseif ('hasItem' === $call->name) { | ||
139 | ++$statistics[$name]['reads']; | ||
140 | foreach ($call->result ?? [] as $result) { | ||
141 | ++$statistics[$name][$result ? 'hits' : 'misses']; | ||
142 | } | ||
143 | } elseif ('save' === $call->name) { | ||
144 | ++$statistics[$name]['writes']; | ||
145 | } elseif ('deleteItem' === $call->name) { | ||
146 | ++$statistics[$name]['deletes']; | ||
147 | } | ||
148 | } | ||
149 | if ($statistics[$name]['reads']) { | ||
150 | $statistics[$name]['hit_read_ratio'] = round(100 * $statistics[$name]['hits'] / $statistics[$name]['reads'], 2); | ||
151 | } else { | ||
152 | $statistics[$name]['hit_read_ratio'] = null; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | return $statistics; | ||
157 | } | ||
158 | |||
159 | private function calculateTotalStatistics(): array | ||
160 | { | ||
161 | $statistics = $this->getStatistics(); | ||
162 | $totals = [ | ||
163 | 'calls' => 0, | ||
164 | 'time' => 0, | ||
165 | 'reads' => 0, | ||
166 | 'writes' => 0, | ||
167 | 'deletes' => 0, | ||
168 | 'hits' => 0, | ||
169 | 'misses' => 0, | ||
170 | ]; | ||
171 | foreach ($statistics as $name => $values) { | ||
172 | foreach ($totals as $key => $value) { | ||
173 | $totals[$key] += $statistics[$name][$key]; | ||
174 | } | ||
175 | } | ||
176 | if ($totals['reads']) { | ||
177 | $totals['hit_read_ratio'] = round(100 * $totals['hits'] / $totals['reads'], 2); | ||
178 | } else { | ||
179 | $totals['hit_read_ratio'] = null; | ||
180 | } | ||
181 | |||
182 | return $totals; | ||
183 | } | ||
184 | } | ||
diff --git a/vendor/symfony/cache/DependencyInjection/CacheCollectorPass.php b/vendor/symfony/cache/DependencyInjection/CacheCollectorPass.php new file mode 100644 index 0000000..ed95740 --- /dev/null +++ b/vendor/symfony/cache/DependencyInjection/CacheCollectorPass.php | |||
@@ -0,0 +1,75 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\DependencyInjection; | ||
13 | |||
14 | use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface; | ||
15 | use Symfony\Component\Cache\Adapter\TraceableAdapter; | ||
16 | use Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter; | ||
17 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
18 | use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
19 | use Symfony\Component\DependencyInjection\Definition; | ||
20 | use Symfony\Component\DependencyInjection\Reference; | ||
21 | |||
22 | /** | ||
23 | * Inject a data collector to all the cache services to be able to get detailed statistics. | ||
24 | * | ||
25 | * @author Tobias Nyholm <tobias.nyholm@gmail.com> | ||
26 | */ | ||
27 | class CacheCollectorPass implements CompilerPassInterface | ||
28 | { | ||
29 | public function process(ContainerBuilder $container): void | ||
30 | { | ||
31 | if (!$container->hasDefinition('data_collector.cache')) { | ||
32 | return; | ||
33 | } | ||
34 | |||
35 | foreach ($container->findTaggedServiceIds('cache.pool') as $id => $attributes) { | ||
36 | $poolName = $attributes[0]['name'] ?? $id; | ||
37 | |||
38 | $this->addToCollector($id, $poolName, $container); | ||
39 | } | ||
40 | } | ||
41 | |||
42 | private function addToCollector(string $id, string $name, ContainerBuilder $container): void | ||
43 | { | ||
44 | $definition = $container->getDefinition($id); | ||
45 | if ($definition->isAbstract()) { | ||
46 | return; | ||
47 | } | ||
48 | |||
49 | $collectorDefinition = $container->getDefinition('data_collector.cache'); | ||
50 | $recorder = new Definition(is_subclass_of($definition->getClass(), TagAwareAdapterInterface::class) ? TraceableTagAwareAdapter::class : TraceableAdapter::class); | ||
51 | $recorder->setTags($definition->getTags()); | ||
52 | if (!$definition->isPublic() || !$definition->isPrivate()) { | ||
53 | $recorder->setPublic($definition->isPublic()); | ||
54 | } | ||
55 | $recorder->setArguments([new Reference($innerId = $id.'.recorder_inner')]); | ||
56 | |||
57 | foreach ($definition->getMethodCalls() as [$method, $args]) { | ||
58 | if ('setCallbackWrapper' !== $method || !$args[0] instanceof Definition || !($args[0]->getArguments()[2] ?? null) instanceof Definition) { | ||
59 | continue; | ||
60 | } | ||
61 | if ([new Reference($id), 'setCallbackWrapper'] == $args[0]->getArguments()[2]->getFactory()) { | ||
62 | $args[0]->getArguments()[2]->setFactory([new Reference($innerId), 'setCallbackWrapper']); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | $definition->setTags([]); | ||
67 | $definition->setPublic(false); | ||
68 | |||
69 | $container->setDefinition($innerId, $definition); | ||
70 | $container->setDefinition($id, $recorder); | ||
71 | |||
72 | // Tell the collector to add the new instance | ||
73 | $collectorDefinition->addMethodCall('addInstance', [$name, new Reference($id)]); | ||
74 | } | ||
75 | } | ||
diff --git a/vendor/symfony/cache/DependencyInjection/CachePoolClearerPass.php b/vendor/symfony/cache/DependencyInjection/CachePoolClearerPass.php new file mode 100644 index 0000000..5449720 --- /dev/null +++ b/vendor/symfony/cache/DependencyInjection/CachePoolClearerPass.php | |||
@@ -0,0 +1,38 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\DependencyInjection; | ||
13 | |||
14 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
15 | use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
16 | use Symfony\Component\DependencyInjection\Reference; | ||
17 | |||
18 | /** | ||
19 | * @author Nicolas Grekas <p@tchwork.com> | ||
20 | */ | ||
21 | class CachePoolClearerPass implements CompilerPassInterface | ||
22 | { | ||
23 | public function process(ContainerBuilder $container): void | ||
24 | { | ||
25 | $container->getParameterBag()->remove('cache.prefix.seed'); | ||
26 | |||
27 | foreach ($container->findTaggedServiceIds('cache.pool.clearer') as $id => $attr) { | ||
28 | $clearer = $container->getDefinition($id); | ||
29 | $pools = []; | ||
30 | foreach ($clearer->getArgument(0) as $name => $ref) { | ||
31 | if ($container->hasDefinition($ref)) { | ||
32 | $pools[$name] = new Reference($ref); | ||
33 | } | ||
34 | } | ||
35 | $clearer->replaceArgument(0, $pools); | ||
36 | } | ||
37 | } | ||
38 | } | ||
diff --git a/vendor/symfony/cache/DependencyInjection/CachePoolPass.php b/vendor/symfony/cache/DependencyInjection/CachePoolPass.php new file mode 100644 index 0000000..081d82c --- /dev/null +++ b/vendor/symfony/cache/DependencyInjection/CachePoolPass.php | |||
@@ -0,0 +1,243 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\DependencyInjection; | ||
13 | |||
14 | use Symfony\Component\Cache\Adapter\AbstractAdapter; | ||
15 | use Symfony\Component\Cache\Adapter\ArrayAdapter; | ||
16 | use Symfony\Component\Cache\Adapter\ChainAdapter; | ||
17 | use Symfony\Component\Cache\Adapter\NullAdapter; | ||
18 | use Symfony\Component\Cache\Adapter\ParameterNormalizer; | ||
19 | use Symfony\Component\Cache\Messenger\EarlyExpirationDispatcher; | ||
20 | use Symfony\Component\DependencyInjection\ChildDefinition; | ||
21 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
22 | use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
23 | use Symfony\Component\DependencyInjection\Definition; | ||
24 | use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; | ||
25 | use Symfony\Component\DependencyInjection\Reference; | ||
26 | |||
27 | /** | ||
28 | * @author Nicolas Grekas <p@tchwork.com> | ||
29 | */ | ||
30 | class CachePoolPass implements CompilerPassInterface | ||
31 | { | ||
32 | public function process(ContainerBuilder $container): void | ||
33 | { | ||
34 | if ($container->hasParameter('cache.prefix.seed')) { | ||
35 | $seed = $container->getParameterBag()->resolveValue($container->getParameter('cache.prefix.seed')); | ||
36 | } else { | ||
37 | $seed = '_'.$container->getParameter('kernel.project_dir'); | ||
38 | $seed .= '.'.$container->getParameter('kernel.container_class'); | ||
39 | } | ||
40 | |||
41 | $needsMessageHandler = false; | ||
42 | $allPools = []; | ||
43 | $clearers = []; | ||
44 | $attributes = [ | ||
45 | 'provider', | ||
46 | 'name', | ||
47 | 'namespace', | ||
48 | 'default_lifetime', | ||
49 | 'early_expiration_message_bus', | ||
50 | 'reset', | ||
51 | ]; | ||
52 | foreach ($container->findTaggedServiceIds('cache.pool') as $id => $tags) { | ||
53 | $adapter = $pool = $container->getDefinition($id); | ||
54 | if ($pool->isAbstract()) { | ||
55 | continue; | ||
56 | } | ||
57 | $class = $adapter->getClass(); | ||
58 | while ($adapter instanceof ChildDefinition) { | ||
59 | $adapter = $container->findDefinition($adapter->getParent()); | ||
60 | $class = $class ?: $adapter->getClass(); | ||
61 | if ($t = $adapter->getTag('cache.pool')) { | ||
62 | $tags[0] += $t[0]; | ||
63 | } | ||
64 | } | ||
65 | $name = $tags[0]['name'] ?? $id; | ||
66 | if (!isset($tags[0]['namespace'])) { | ||
67 | $namespaceSeed = $seed; | ||
68 | if (null !== $class) { | ||
69 | $namespaceSeed .= '.'.$class; | ||
70 | } | ||
71 | |||
72 | $tags[0]['namespace'] = $this->getNamespace($namespaceSeed, $name); | ||
73 | } | ||
74 | if (isset($tags[0]['clearer'])) { | ||
75 | $clearer = $tags[0]['clearer']; | ||
76 | while ($container->hasAlias($clearer)) { | ||
77 | $clearer = (string) $container->getAlias($clearer); | ||
78 | } | ||
79 | } else { | ||
80 | $clearer = null; | ||
81 | } | ||
82 | unset($tags[0]['clearer'], $tags[0]['name']); | ||
83 | |||
84 | if (isset($tags[0]['provider'])) { | ||
85 | $tags[0]['provider'] = new Reference(static::getServiceProvider($container, $tags[0]['provider'])); | ||
86 | } | ||
87 | |||
88 | if (ChainAdapter::class === $class) { | ||
89 | $adapters = []; | ||
90 | foreach ($adapter->getArgument(0) as $provider => $adapter) { | ||
91 | if ($adapter instanceof ChildDefinition) { | ||
92 | $chainedPool = $adapter; | ||
93 | } else { | ||
94 | $chainedPool = $adapter = new ChildDefinition($adapter); | ||
95 | } | ||
96 | |||
97 | $chainedTags = [\is_int($provider) ? [] : ['provider' => $provider]]; | ||
98 | $chainedClass = ''; | ||
99 | |||
100 | while ($adapter instanceof ChildDefinition) { | ||
101 | $adapter = $container->findDefinition($adapter->getParent()); | ||
102 | $chainedClass = $chainedClass ?: $adapter->getClass(); | ||
103 | if ($t = $adapter->getTag('cache.pool')) { | ||
104 | $chainedTags[0] += $t[0]; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | if (ChainAdapter::class === $chainedClass) { | ||
109 | throw new InvalidArgumentException(sprintf('Invalid service "%s": chain of adapters cannot reference another chain, found "%s".', $id, $chainedPool->getParent())); | ||
110 | } | ||
111 | |||
112 | $i = 0; | ||
113 | |||
114 | if (isset($chainedTags[0]['provider'])) { | ||
115 | $chainedPool->replaceArgument($i++, new Reference(static::getServiceProvider($container, $chainedTags[0]['provider']))); | ||
116 | } | ||
117 | |||
118 | if (isset($tags[0]['namespace']) && !\in_array($adapter->getClass(), [ArrayAdapter::class, NullAdapter::class], true)) { | ||
119 | $chainedPool->replaceArgument($i++, $tags[0]['namespace']); | ||
120 | } | ||
121 | |||
122 | if (isset($tags[0]['default_lifetime'])) { | ||
123 | $chainedPool->replaceArgument($i++, $tags[0]['default_lifetime']); | ||
124 | } | ||
125 | |||
126 | $adapters[] = $chainedPool; | ||
127 | } | ||
128 | |||
129 | $pool->replaceArgument(0, $adapters); | ||
130 | unset($tags[0]['provider'], $tags[0]['namespace']); | ||
131 | $i = 1; | ||
132 | } else { | ||
133 | $i = 0; | ||
134 | } | ||
135 | |||
136 | foreach ($attributes as $attr) { | ||
137 | if (!isset($tags[0][$attr])) { | ||
138 | // no-op | ||
139 | } elseif ('reset' === $attr) { | ||
140 | if ($tags[0][$attr]) { | ||
141 | $pool->addTag('kernel.reset', ['method' => $tags[0][$attr]]); | ||
142 | } | ||
143 | } elseif ('early_expiration_message_bus' === $attr) { | ||
144 | $needsMessageHandler = true; | ||
145 | $pool->addMethodCall('setCallbackWrapper', [(new Definition(EarlyExpirationDispatcher::class)) | ||
146 | ->addArgument(new Reference($tags[0]['early_expiration_message_bus'])) | ||
147 | ->addArgument(new Reference('reverse_container')) | ||
148 | ->addArgument((new Definition('callable')) | ||
149 | ->setFactory([new Reference($id), 'setCallbackWrapper']) | ||
150 | ->addArgument(null) | ||
151 | ), | ||
152 | ]); | ||
153 | $pool->addTag('container.reversible'); | ||
154 | } elseif ('namespace' !== $attr || !\in_array($class, [ArrayAdapter::class, NullAdapter::class], true)) { | ||
155 | $argument = $tags[0][$attr]; | ||
156 | |||
157 | if ('default_lifetime' === $attr && !is_numeric($argument)) { | ||
158 | $argument = (new Definition('int', [$argument])) | ||
159 | ->setFactory([ParameterNormalizer::class, 'normalizeDuration']); | ||
160 | } | ||
161 | |||
162 | $pool->replaceArgument($i++, $argument); | ||
163 | } | ||
164 | unset($tags[0][$attr]); | ||
165 | } | ||
166 | if (!empty($tags[0])) { | ||
167 | throw new InvalidArgumentException(sprintf('Invalid "cache.pool" tag for service "%s": accepted attributes are "clearer", "provider", "name", "namespace", "default_lifetime", "early_expiration_message_bus" and "reset", found "%s".', $id, implode('", "', array_keys($tags[0])))); | ||
168 | } | ||
169 | |||
170 | if (null !== $clearer) { | ||
171 | $clearers[$clearer][$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE); | ||
172 | } | ||
173 | |||
174 | $allPools[$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE); | ||
175 | } | ||
176 | |||
177 | if (!$needsMessageHandler) { | ||
178 | $container->removeDefinition('cache.early_expiration_handler'); | ||
179 | } | ||
180 | |||
181 | $notAliasedCacheClearerId = 'cache.global_clearer'; | ||
182 | while ($container->hasAlias($notAliasedCacheClearerId)) { | ||
183 | $notAliasedCacheClearerId = (string) $container->getAlias($notAliasedCacheClearerId); | ||
184 | } | ||
185 | if ($container->hasDefinition($notAliasedCacheClearerId)) { | ||
186 | $clearers[$notAliasedCacheClearerId] = $allPools; | ||
187 | } | ||
188 | |||
189 | foreach ($clearers as $id => $pools) { | ||
190 | $clearer = $container->getDefinition($id); | ||
191 | if ($clearer instanceof ChildDefinition) { | ||
192 | $clearer->replaceArgument(0, $pools); | ||
193 | } else { | ||
194 | $clearer->setArgument(0, $pools); | ||
195 | } | ||
196 | $clearer->addTag('cache.pool.clearer'); | ||
197 | |||
198 | if ('cache.system_clearer' === $id) { | ||
199 | $clearer->addTag('kernel.cache_clearer'); | ||
200 | } | ||
201 | } | ||
202 | |||
203 | $allPoolsKeys = array_keys($allPools); | ||
204 | |||
205 | if ($container->hasDefinition('console.command.cache_pool_list')) { | ||
206 | $container->getDefinition('console.command.cache_pool_list')->replaceArgument(0, $allPoolsKeys); | ||
207 | } | ||
208 | |||
209 | if ($container->hasDefinition('console.command.cache_pool_clear')) { | ||
210 | $container->getDefinition('console.command.cache_pool_clear')->addArgument($allPoolsKeys); | ||
211 | } | ||
212 | |||
213 | if ($container->hasDefinition('console.command.cache_pool_delete')) { | ||
214 | $container->getDefinition('console.command.cache_pool_delete')->addArgument($allPoolsKeys); | ||
215 | } | ||
216 | } | ||
217 | |||
218 | private function getNamespace(string $seed, string $id): string | ||
219 | { | ||
220 | return substr(str_replace('/', '-', base64_encode(hash('xxh128', $id.$seed, true))), 0, 10); | ||
221 | } | ||
222 | |||
223 | /** | ||
224 | * @internal | ||
225 | */ | ||
226 | public static function getServiceProvider(ContainerBuilder $container, string $name): string | ||
227 | { | ||
228 | $container->resolveEnvPlaceholders($name, null, $usedEnvs); | ||
229 | |||
230 | if ($usedEnvs || preg_match('#^[a-z]++:#', $name)) { | ||
231 | $dsn = $name; | ||
232 | |||
233 | if (!$container->hasDefinition($name = '.cache_connection.'.ContainerBuilder::hash($dsn))) { | ||
234 | $definition = new Definition(AbstractAdapter::class); | ||
235 | $definition->setFactory([AbstractAdapter::class, 'createConnection']); | ||
236 | $definition->setArguments([$dsn, ['lazy' => true]]); | ||
237 | $container->setDefinition($name, $definition); | ||
238 | } | ||
239 | } | ||
240 | |||
241 | return $name; | ||
242 | } | ||
243 | } | ||
diff --git a/vendor/symfony/cache/DependencyInjection/CachePoolPrunerPass.php b/vendor/symfony/cache/DependencyInjection/CachePoolPrunerPass.php new file mode 100644 index 0000000..69b69fb --- /dev/null +++ b/vendor/symfony/cache/DependencyInjection/CachePoolPrunerPass.php | |||
@@ -0,0 +1,48 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\DependencyInjection; | ||
13 | |||
14 | use Symfony\Component\Cache\PruneableInterface; | ||
15 | use Symfony\Component\DependencyInjection\Argument\IteratorArgument; | ||
16 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
17 | use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
18 | use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; | ||
19 | use Symfony\Component\DependencyInjection\Reference; | ||
20 | |||
21 | /** | ||
22 | * @author Rob Frawley 2nd <rmf@src.run> | ||
23 | */ | ||
24 | class CachePoolPrunerPass implements CompilerPassInterface | ||
25 | { | ||
26 | public function process(ContainerBuilder $container): void | ||
27 | { | ||
28 | if (!$container->hasDefinition('console.command.cache_pool_prune')) { | ||
29 | return; | ||
30 | } | ||
31 | |||
32 | $services = []; | ||
33 | |||
34 | foreach ($container->findTaggedServiceIds('cache.pool') as $id => $tags) { | ||
35 | $class = $container->getParameterBag()->resolveValue($container->getDefinition($id)->getClass()); | ||
36 | |||
37 | if (!$reflection = $container->getReflectionClass($class)) { | ||
38 | throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); | ||
39 | } | ||
40 | |||
41 | if ($reflection->implementsInterface(PruneableInterface::class)) { | ||
42 | $services[$id] = new Reference($id); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | $container->getDefinition('console.command.cache_pool_prune')->replaceArgument(0, new IteratorArgument($services)); | ||
47 | } | ||
48 | } | ||
diff --git a/vendor/symfony/cache/Exception/CacheException.php b/vendor/symfony/cache/Exception/CacheException.php new file mode 100644 index 0000000..d2e975b --- /dev/null +++ b/vendor/symfony/cache/Exception/CacheException.php | |||
@@ -0,0 +1,25 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Exception; | ||
13 | |||
14 | use Psr\Cache\CacheException as Psr6CacheInterface; | ||
15 | use Psr\SimpleCache\CacheException as SimpleCacheInterface; | ||
16 | |||
17 | if (interface_exists(SimpleCacheInterface::class)) { | ||
18 | class CacheException extends \Exception implements Psr6CacheInterface, SimpleCacheInterface | ||
19 | { | ||
20 | } | ||
21 | } else { | ||
22 | class CacheException extends \Exception implements Psr6CacheInterface | ||
23 | { | ||
24 | } | ||
25 | } | ||
diff --git a/vendor/symfony/cache/Exception/InvalidArgumentException.php b/vendor/symfony/cache/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..7f9584a --- /dev/null +++ b/vendor/symfony/cache/Exception/InvalidArgumentException.php | |||
@@ -0,0 +1,25 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Exception; | ||
13 | |||
14 | use Psr\Cache\InvalidArgumentException as Psr6CacheInterface; | ||
15 | use Psr\SimpleCache\InvalidArgumentException as SimpleCacheInterface; | ||
16 | |||
17 | if (interface_exists(SimpleCacheInterface::class)) { | ||
18 | class InvalidArgumentException extends \InvalidArgumentException implements Psr6CacheInterface, SimpleCacheInterface | ||
19 | { | ||
20 | } | ||
21 | } else { | ||
22 | class InvalidArgumentException extends \InvalidArgumentException implements Psr6CacheInterface | ||
23 | { | ||
24 | } | ||
25 | } | ||
diff --git a/vendor/symfony/cache/Exception/LogicException.php b/vendor/symfony/cache/Exception/LogicException.php new file mode 100644 index 0000000..9ffa7ed --- /dev/null +++ b/vendor/symfony/cache/Exception/LogicException.php | |||
@@ -0,0 +1,25 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Exception; | ||
13 | |||
14 | use Psr\Cache\CacheException as Psr6CacheInterface; | ||
15 | use Psr\SimpleCache\CacheException as SimpleCacheInterface; | ||
16 | |||
17 | if (interface_exists(SimpleCacheInterface::class)) { | ||
18 | class LogicException extends \LogicException implements Psr6CacheInterface, SimpleCacheInterface | ||
19 | { | ||
20 | } | ||
21 | } else { | ||
22 | class LogicException extends \LogicException implements Psr6CacheInterface | ||
23 | { | ||
24 | } | ||
25 | } | ||
diff --git a/vendor/symfony/cache/LICENSE b/vendor/symfony/cache/LICENSE new file mode 100644 index 0000000..0223acd --- /dev/null +++ b/vendor/symfony/cache/LICENSE | |||
@@ -0,0 +1,19 @@ | |||
1 | Copyright (c) 2016-present Fabien Potencier | ||
2 | |||
3 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
4 | of this software and associated documentation files (the "Software"), to deal | ||
5 | in the Software without restriction, including without limitation the rights | ||
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
7 | copies of the Software, and to permit persons to whom the Software is furnished | ||
8 | to do so, subject to the following conditions: | ||
9 | |||
10 | The above copyright notice and this permission notice shall be included in all | ||
11 | copies or substantial portions of the Software. | ||
12 | |||
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
19 | THE SOFTWARE. | ||
diff --git a/vendor/symfony/cache/LockRegistry.php b/vendor/symfony/cache/LockRegistry.php new file mode 100644 index 0000000..c5c5fde --- /dev/null +++ b/vendor/symfony/cache/LockRegistry.php | |||
@@ -0,0 +1,166 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache; | ||
13 | |||
14 | use Psr\Log\LoggerInterface; | ||
15 | use Symfony\Contracts\Cache\CacheInterface; | ||
16 | use Symfony\Contracts\Cache\ItemInterface; | ||
17 | |||
18 | /** | ||
19 | * LockRegistry is used internally by existing adapters to protect against cache stampede. | ||
20 | * | ||
21 | * It does so by wrapping the computation of items in a pool of locks. | ||
22 | * Foreach each apps, there can be at most 20 concurrent processes that | ||
23 | * compute items at the same time and only one per cache-key. | ||
24 | * | ||
25 | * @author Nicolas Grekas <p@tchwork.com> | ||
26 | */ | ||
27 | final class LockRegistry | ||
28 | { | ||
29 | private static array $openedFiles = []; | ||
30 | private static ?array $lockedFiles = null; | ||
31 | private static \Exception $signalingException; | ||
32 | private static \Closure $signalingCallback; | ||
33 | |||
34 | /** | ||
35 | * The number of items in this list controls the max number of concurrent processes. | ||
36 | */ | ||
37 | private static array $files = [ | ||
38 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'AbstractAdapter.php', | ||
39 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'AbstractTagAwareAdapter.php', | ||
40 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'AdapterInterface.php', | ||
41 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'ApcuAdapter.php', | ||
42 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'ArrayAdapter.php', | ||
43 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'ChainAdapter.php', | ||
44 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'CouchbaseBucketAdapter.php', | ||
45 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'CouchbaseCollectionAdapter.php', | ||
46 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'DoctrineDbalAdapter.php', | ||
47 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'FilesystemAdapter.php', | ||
48 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'FilesystemTagAwareAdapter.php', | ||
49 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'MemcachedAdapter.php', | ||
50 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'NullAdapter.php', | ||
51 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'ParameterNormalizer.php', | ||
52 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'PdoAdapter.php', | ||
53 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'PhpArrayAdapter.php', | ||
54 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'PhpFilesAdapter.php', | ||
55 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'ProxyAdapter.php', | ||
56 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'Psr16Adapter.php', | ||
57 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'RedisAdapter.php', | ||
58 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'RedisTagAwareAdapter.php', | ||
59 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'TagAwareAdapter.php', | ||
60 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'TagAwareAdapterInterface.php', | ||
61 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'TraceableAdapter.php', | ||
62 | __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'TraceableTagAwareAdapter.php', | ||
63 | ]; | ||
64 | |||
65 | /** | ||
66 | * Defines a set of existing files that will be used as keys to acquire locks. | ||
67 | * | ||
68 | * @return array The previously defined set of files | ||
69 | */ | ||
70 | public static function setFiles(array $files): array | ||
71 | { | ||
72 | $previousFiles = self::$files; | ||
73 | self::$files = $files; | ||
74 | |||
75 | foreach (self::$openedFiles as $file) { | ||
76 | if ($file) { | ||
77 | flock($file, \LOCK_UN); | ||
78 | fclose($file); | ||
79 | } | ||
80 | } | ||
81 | self::$openedFiles = self::$lockedFiles = []; | ||
82 | |||
83 | return $previousFiles; | ||
84 | } | ||
85 | |||
86 | public static function compute(callable $callback, ItemInterface $item, bool &$save, CacheInterface $pool, ?\Closure $setMetadata = null, ?LoggerInterface $logger = null): mixed | ||
87 | { | ||
88 | if ('\\' === \DIRECTORY_SEPARATOR && null === self::$lockedFiles) { | ||
89 | // disable locking on Windows by default | ||
90 | self::$files = self::$lockedFiles = []; | ||
91 | } | ||
92 | |||
93 | $key = self::$files ? abs(crc32($item->getKey())) % \count(self::$files) : -1; | ||
94 | |||
95 | if ($key < 0 || self::$lockedFiles || !$lock = self::open($key)) { | ||
96 | return $callback($item, $save); | ||
97 | } | ||
98 | |||
99 | self::$signalingException ??= unserialize("O:9:\"Exception\":1:{s:16:\"\0Exception\0trace\";a:0:{}}"); | ||
100 | self::$signalingCallback ??= fn () => throw self::$signalingException; | ||
101 | |||
102 | while (true) { | ||
103 | try { | ||
104 | // race to get the lock in non-blocking mode | ||
105 | $locked = flock($lock, \LOCK_EX | \LOCK_NB, $wouldBlock); | ||
106 | |||
107 | if ($locked || !$wouldBlock) { | ||
108 | $logger?->info(sprintf('Lock %s, now computing item "{key}"', $locked ? 'acquired' : 'not supported'), ['key' => $item->getKey()]); | ||
109 | self::$lockedFiles[$key] = true; | ||
110 | |||
111 | $value = $callback($item, $save); | ||
112 | |||
113 | if ($save) { | ||
114 | if ($setMetadata) { | ||
115 | $setMetadata($item); | ||
116 | } | ||
117 | |||
118 | $pool->save($item->set($value)); | ||
119 | $save = false; | ||
120 | } | ||
121 | |||
122 | return $value; | ||
123 | } | ||
124 | // if we failed the race, retry locking in blocking mode to wait for the winner | ||
125 | $logger?->info('Item "{key}" is locked, waiting for it to be released', ['key' => $item->getKey()]); | ||
126 | flock($lock, \LOCK_SH); | ||
127 | } finally { | ||
128 | flock($lock, \LOCK_UN); | ||
129 | unset(self::$lockedFiles[$key]); | ||
130 | } | ||
131 | |||
132 | try { | ||
133 | $value = $pool->get($item->getKey(), self::$signalingCallback, 0); | ||
134 | $logger?->info('Item "{key}" retrieved after lock was released', ['key' => $item->getKey()]); | ||
135 | $save = false; | ||
136 | |||
137 | return $value; | ||
138 | } catch (\Exception $e) { | ||
139 | if (self::$signalingException !== $e) { | ||
140 | throw $e; | ||
141 | } | ||
142 | $logger?->info('Item "{key}" not found while lock was released, now retrying', ['key' => $item->getKey()]); | ||
143 | } | ||
144 | } | ||
145 | |||
146 | return null; | ||
147 | } | ||
148 | |||
149 | /** | ||
150 | * @return resource|false | ||
151 | */ | ||
152 | private static function open(int $key) | ||
153 | { | ||
154 | if (null !== $h = self::$openedFiles[$key] ?? null) { | ||
155 | return $h; | ||
156 | } | ||
157 | set_error_handler(static fn () => null); | ||
158 | try { | ||
159 | $h = fopen(self::$files[$key], 'r+'); | ||
160 | } finally { | ||
161 | restore_error_handler(); | ||
162 | } | ||
163 | |||
164 | return self::$openedFiles[$key] = $h ?: @fopen(self::$files[$key], 'r'); | ||
165 | } | ||
166 | } | ||
diff --git a/vendor/symfony/cache/Marshaller/DefaultMarshaller.php b/vendor/symfony/cache/Marshaller/DefaultMarshaller.php new file mode 100644 index 0000000..34bbeb8 --- /dev/null +++ b/vendor/symfony/cache/Marshaller/DefaultMarshaller.php | |||
@@ -0,0 +1,98 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Marshaller; | ||
13 | |||
14 | use Symfony\Component\Cache\Exception\CacheException; | ||
15 | |||
16 | /** | ||
17 | * Serializes/unserializes values using igbinary_serialize() if available, serialize() otherwise. | ||
18 | * | ||
19 | * @author Nicolas Grekas <p@tchwork.com> | ||
20 | */ | ||
21 | class DefaultMarshaller implements MarshallerInterface | ||
22 | { | ||
23 | private bool $useIgbinarySerialize = true; | ||
24 | private bool $throwOnSerializationFailure = false; | ||
25 | |||
26 | public function __construct(?bool $useIgbinarySerialize = null, bool $throwOnSerializationFailure = false) | ||
27 | { | ||
28 | if (null === $useIgbinarySerialize) { | ||
29 | $useIgbinarySerialize = \extension_loaded('igbinary') && version_compare('3.1.6', phpversion('igbinary'), '<='); | ||
30 | } elseif ($useIgbinarySerialize && (!\extension_loaded('igbinary') || version_compare('3.1.6', phpversion('igbinary'), '>'))) { | ||
31 | throw new CacheException(\extension_loaded('igbinary') ? 'Please upgrade the "igbinary" PHP extension to v3.1.6 or higher.' : 'The "igbinary" PHP extension is not loaded.'); | ||
32 | } | ||
33 | $this->useIgbinarySerialize = $useIgbinarySerialize; | ||
34 | $this->throwOnSerializationFailure = $throwOnSerializationFailure; | ||
35 | } | ||
36 | |||
37 | public function marshall(array $values, ?array &$failed): array | ||
38 | { | ||
39 | $serialized = $failed = []; | ||
40 | |||
41 | foreach ($values as $id => $value) { | ||
42 | try { | ||
43 | if ($this->useIgbinarySerialize) { | ||
44 | $serialized[$id] = igbinary_serialize($value); | ||
45 | } else { | ||
46 | $serialized[$id] = serialize($value); | ||
47 | } | ||
48 | } catch (\Exception $e) { | ||
49 | if ($this->throwOnSerializationFailure) { | ||
50 | throw new \ValueError($e->getMessage(), 0, $e); | ||
51 | } | ||
52 | $failed[] = $id; | ||
53 | } | ||
54 | } | ||
55 | |||
56 | return $serialized; | ||
57 | } | ||
58 | |||
59 | public function unmarshall(string $value): mixed | ||
60 | { | ||
61 | if ('b:0;' === $value) { | ||
62 | return false; | ||
63 | } | ||
64 | if ('N;' === $value) { | ||
65 | return null; | ||
66 | } | ||
67 | static $igbinaryNull; | ||
68 | if ($value === $igbinaryNull ??= \extension_loaded('igbinary') ? igbinary_serialize(null) : false) { | ||
69 | return null; | ||
70 | } | ||
71 | $unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback'); | ||
72 | try { | ||
73 | if (':' === ($value[1] ?? ':')) { | ||
74 | if (false !== $value = unserialize($value)) { | ||
75 | return $value; | ||
76 | } | ||
77 | } elseif (false === $igbinaryNull) { | ||
78 | throw new \RuntimeException('Failed to unserialize values, did you forget to install the "igbinary" extension?'); | ||
79 | } elseif (null !== $value = igbinary_unserialize($value)) { | ||
80 | return $value; | ||
81 | } | ||
82 | |||
83 | throw new \DomainException(error_get_last() ? error_get_last()['message'] : 'Failed to unserialize values.'); | ||
84 | } catch (\Error $e) { | ||
85 | throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine()); | ||
86 | } finally { | ||
87 | ini_set('unserialize_callback_func', $unserializeCallbackHandler); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | /** | ||
92 | * @internal | ||
93 | */ | ||
94 | public static function handleUnserializeCallback(string $class): never | ||
95 | { | ||
96 | throw new \DomainException('Class not found: '.$class); | ||
97 | } | ||
98 | } | ||
diff --git a/vendor/symfony/cache/Marshaller/DeflateMarshaller.php b/vendor/symfony/cache/Marshaller/DeflateMarshaller.php new file mode 100644 index 0000000..f35241c --- /dev/null +++ b/vendor/symfony/cache/Marshaller/DeflateMarshaller.php | |||
@@ -0,0 +1,44 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Marshaller; | ||
13 | |||
14 | use Symfony\Component\Cache\Exception\CacheException; | ||
15 | |||
16 | /** | ||
17 | * Compresses values using gzdeflate(). | ||
18 | * | ||
19 | * @author Nicolas Grekas <p@tchwork.com> | ||
20 | */ | ||
21 | class DeflateMarshaller implements MarshallerInterface | ||
22 | { | ||
23 | public function __construct( | ||
24 | private MarshallerInterface $marshaller, | ||
25 | ) { | ||
26 | if (!\function_exists('gzdeflate')) { | ||
27 | throw new CacheException('The "zlib" PHP extension is not loaded.'); | ||
28 | } | ||
29 | } | ||
30 | |||
31 | public function marshall(array $values, ?array &$failed): array | ||
32 | { | ||
33 | return array_map('gzdeflate', $this->marshaller->marshall($values, $failed)); | ||
34 | } | ||
35 | |||
36 | public function unmarshall(string $value): mixed | ||
37 | { | ||
38 | if (false !== $inflatedValue = @gzinflate($value)) { | ||
39 | $value = $inflatedValue; | ||
40 | } | ||
41 | |||
42 | return $this->marshaller->unmarshall($value); | ||
43 | } | ||
44 | } | ||
diff --git a/vendor/symfony/cache/Marshaller/MarshallerInterface.php b/vendor/symfony/cache/Marshaller/MarshallerInterface.php new file mode 100644 index 0000000..5b81aad --- /dev/null +++ b/vendor/symfony/cache/Marshaller/MarshallerInterface.php | |||
@@ -0,0 +1,38 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Marshaller; | ||
13 | |||
14 | /** | ||
15 | * Serializes/unserializes PHP values. | ||
16 | * | ||
17 | * Implementations of this interface MUST deal with errors carefully. They MUST | ||
18 | * also deal with forward and backward compatibility at the storage format level. | ||
19 | * | ||
20 | * @author Nicolas Grekas <p@tchwork.com> | ||
21 | */ | ||
22 | interface MarshallerInterface | ||
23 | { | ||
24 | /** | ||
25 | * Serializes a list of values. | ||
26 | * | ||
27 | * When serialization fails for a specific value, no exception should be | ||
28 | * thrown. Instead, its key should be listed in $failed. | ||
29 | */ | ||
30 | public function marshall(array $values, ?array &$failed): array; | ||
31 | |||
32 | /** | ||
33 | * Unserializes a single value and throws an exception if anything goes wrong. | ||
34 | * | ||
35 | * @throws \Exception Whenever unserialization fails | ||
36 | */ | ||
37 | public function unmarshall(string $value): mixed; | ||
38 | } | ||
diff --git a/vendor/symfony/cache/Marshaller/SodiumMarshaller.php b/vendor/symfony/cache/Marshaller/SodiumMarshaller.php new file mode 100644 index 0000000..77d16e8 --- /dev/null +++ b/vendor/symfony/cache/Marshaller/SodiumMarshaller.php | |||
@@ -0,0 +1,74 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Marshaller; | ||
13 | |||
14 | use Symfony\Component\Cache\Exception\CacheException; | ||
15 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
16 | |||
17 | /** | ||
18 | * Encrypt/decrypt values using Libsodium. | ||
19 | * | ||
20 | * @author Ahmed TAILOULOUTE <ahmed.tailouloute@gmail.com> | ||
21 | */ | ||
22 | class SodiumMarshaller implements MarshallerInterface | ||
23 | { | ||
24 | private MarshallerInterface $marshaller; | ||
25 | |||
26 | /** | ||
27 | * @param string[] $decryptionKeys The key at index "0" is required and is used to decrypt and encrypt values; | ||
28 | * more rotating keys can be provided to decrypt values; | ||
29 | * each key must be generated using sodium_crypto_box_keypair() | ||
30 | */ | ||
31 | public function __construct( | ||
32 | private array $decryptionKeys, | ||
33 | ?MarshallerInterface $marshaller = null, | ||
34 | ) { | ||
35 | if (!self::isSupported()) { | ||
36 | throw new CacheException('The "sodium" PHP extension is not loaded.'); | ||
37 | } | ||
38 | |||
39 | if (!isset($decryptionKeys[0])) { | ||
40 | throw new InvalidArgumentException('At least one decryption key must be provided at index "0".'); | ||
41 | } | ||
42 | |||
43 | $this->marshaller = $marshaller ?? new DefaultMarshaller(); | ||
44 | } | ||
45 | |||
46 | public static function isSupported(): bool | ||
47 | { | ||
48 | return \function_exists('sodium_crypto_box_seal'); | ||
49 | } | ||
50 | |||
51 | public function marshall(array $values, ?array &$failed): array | ||
52 | { | ||
53 | $encryptionKey = sodium_crypto_box_publickey($this->decryptionKeys[0]); | ||
54 | |||
55 | $encryptedValues = []; | ||
56 | foreach ($this->marshaller->marshall($values, $failed) as $k => $v) { | ||
57 | $encryptedValues[$k] = sodium_crypto_box_seal($v, $encryptionKey); | ||
58 | } | ||
59 | |||
60 | return $encryptedValues; | ||
61 | } | ||
62 | |||
63 | public function unmarshall(string $value): mixed | ||
64 | { | ||
65 | foreach ($this->decryptionKeys as $k) { | ||
66 | if (false !== $decryptedValue = @sodium_crypto_box_seal_open($value, $k)) { | ||
67 | $value = $decryptedValue; | ||
68 | break; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | return $this->marshaller->unmarshall($value); | ||
73 | } | ||
74 | } | ||
diff --git a/vendor/symfony/cache/Marshaller/TagAwareMarshaller.php b/vendor/symfony/cache/Marshaller/TagAwareMarshaller.php new file mode 100644 index 0000000..825f32c --- /dev/null +++ b/vendor/symfony/cache/Marshaller/TagAwareMarshaller.php | |||
@@ -0,0 +1,83 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Marshaller; | ||
13 | |||
14 | /** | ||
15 | * A marshaller optimized for data structures generated by AbstractTagAwareAdapter. | ||
16 | * | ||
17 | * @author Nicolas Grekas <p@tchwork.com> | ||
18 | */ | ||
19 | class TagAwareMarshaller implements MarshallerInterface | ||
20 | { | ||
21 | private MarshallerInterface $marshaller; | ||
22 | |||
23 | public function __construct(?MarshallerInterface $marshaller = null) | ||
24 | { | ||
25 | $this->marshaller = $marshaller ?? new DefaultMarshaller(); | ||
26 | } | ||
27 | |||
28 | public function marshall(array $values, ?array &$failed): array | ||
29 | { | ||
30 | $failed = $notSerialized = $serialized = []; | ||
31 | |||
32 | foreach ($values as $id => $value) { | ||
33 | if (\is_array($value) && \is_array($value['tags'] ?? null) && \array_key_exists('value', $value) && \count($value) === 2 + (\is_string($value['meta'] ?? null) && 8 === \strlen($value['meta']))) { | ||
34 | // if the value is an array with keys "tags", "value" and "meta", use a compact serialization format | ||
35 | // magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F allow detecting this format quickly in unmarshall() | ||
36 | |||
37 | $v = $this->marshaller->marshall($value, $f); | ||
38 | |||
39 | if ($f) { | ||
40 | $f = []; | ||
41 | $failed[] = $id; | ||
42 | } else { | ||
43 | if ([] === $value['tags']) { | ||
44 | $v['tags'] = ''; | ||
45 | } | ||
46 | |||
47 | $serialized[$id] = "\x9D".($value['meta'] ?? "\0\0\0\0\0\0\0\0").pack('N', \strlen($v['tags'])).$v['tags'].$v['value']; | ||
48 | $serialized[$id][9] = "\x5F"; | ||
49 | } | ||
50 | } else { | ||
51 | // other arbitrary values are serialized using the decorated marshaller below | ||
52 | $notSerialized[$id] = $value; | ||
53 | } | ||
54 | } | ||
55 | |||
56 | if ($notSerialized) { | ||
57 | $serialized += $this->marshaller->marshall($notSerialized, $f); | ||
58 | $failed = array_merge($failed, $f); | ||
59 | } | ||
60 | |||
61 | return $serialized; | ||
62 | } | ||
63 | |||
64 | public function unmarshall(string $value): mixed | ||
65 | { | ||
66 | // detect the compact format used in marshall() using magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F | ||
67 | if (13 >= \strlen($value) || "\x9D" !== $value[0] || "\0" !== $value[5] || "\x5F" !== $value[9]) { | ||
68 | return $this->marshaller->unmarshall($value); | ||
69 | } | ||
70 | |||
71 | // data consists of value, tags and metadata which we need to unpack | ||
72 | $meta = substr($value, 1, 12); | ||
73 | $meta[8] = "\0"; | ||
74 | $tagLen = unpack('Nlen', $meta, 8)['len']; | ||
75 | $meta = substr($meta, 0, 8); | ||
76 | |||
77 | return [ | ||
78 | 'value' => $this->marshaller->unmarshall(substr($value, 13 + $tagLen)), | ||
79 | 'tags' => $tagLen ? $this->marshaller->unmarshall(substr($value, 13, $tagLen)) : [], | ||
80 | 'meta' => "\0\0\0\0\0\0\0\0" === $meta ? null : $meta, | ||
81 | ]; | ||
82 | } | ||
83 | } | ||
diff --git a/vendor/symfony/cache/Messenger/EarlyExpirationDispatcher.php b/vendor/symfony/cache/Messenger/EarlyExpirationDispatcher.php new file mode 100644 index 0000000..d972634 --- /dev/null +++ b/vendor/symfony/cache/Messenger/EarlyExpirationDispatcher.php | |||
@@ -0,0 +1,60 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Messenger; | ||
13 | |||
14 | use Psr\Log\LoggerInterface; | ||
15 | use Symfony\Component\Cache\Adapter\AdapterInterface; | ||
16 | use Symfony\Component\Cache\CacheItem; | ||
17 | use Symfony\Component\DependencyInjection\ReverseContainer; | ||
18 | use Symfony\Component\Messenger\MessageBusInterface; | ||
19 | use Symfony\Component\Messenger\Stamp\HandledStamp; | ||
20 | |||
21 | /** | ||
22 | * Sends the computation of cached values to a message bus. | ||
23 | */ | ||
24 | class EarlyExpirationDispatcher | ||
25 | { | ||
26 | private ?\Closure $callbackWrapper; | ||
27 | |||
28 | public function __construct( | ||
29 | private MessageBusInterface $bus, | ||
30 | private ReverseContainer $reverseContainer, | ||
31 | ?callable $callbackWrapper = null, | ||
32 | ) { | ||
33 | $this->callbackWrapper = null === $callbackWrapper ? null : $callbackWrapper(...); | ||
34 | } | ||
35 | |||
36 | public function __invoke(callable $callback, CacheItem $item, bool &$save, AdapterInterface $pool, \Closure $setMetadata, ?LoggerInterface $logger = null): mixed | ||
37 | { | ||
38 | if (!$item->isHit() || null === $message = EarlyExpirationMessage::create($this->reverseContainer, $callback, $item, $pool)) { | ||
39 | // The item is stale or the callback cannot be reversed: we must compute the value now | ||
40 | $logger?->info('Computing item "{key}" online: '.($item->isHit() ? 'callback cannot be reversed' : 'item is stale'), ['key' => $item->getKey()]); | ||
41 | |||
42 | return null !== $this->callbackWrapper ? ($this->callbackWrapper)($callback, $item, $save, $pool, $setMetadata, $logger) : $callback($item, $save); | ||
43 | } | ||
44 | |||
45 | $envelope = $this->bus->dispatch($message); | ||
46 | |||
47 | if ($logger) { | ||
48 | if ($envelope->last(HandledStamp::class)) { | ||
49 | $logger->info('Item "{key}" was computed online', ['key' => $item->getKey()]); | ||
50 | } else { | ||
51 | $logger->info('Item "{key}" sent for recomputation', ['key' => $item->getKey()]); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | // The item's value is not stale, no need to write it to the backend | ||
56 | $save = false; | ||
57 | |||
58 | return $message->getItem()->get() ?? $item->get(); | ||
59 | } | ||
60 | } | ||
diff --git a/vendor/symfony/cache/Messenger/EarlyExpirationHandler.php b/vendor/symfony/cache/Messenger/EarlyExpirationHandler.php new file mode 100644 index 0000000..adaeb5b --- /dev/null +++ b/vendor/symfony/cache/Messenger/EarlyExpirationHandler.php | |||
@@ -0,0 +1,81 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Messenger; | ||
13 | |||
14 | use Symfony\Component\Cache\CacheItem; | ||
15 | use Symfony\Component\DependencyInjection\ReverseContainer; | ||
16 | use Symfony\Component\Messenger\Attribute\AsMessageHandler; | ||
17 | |||
18 | /** | ||
19 | * Computes cached values sent to a message bus. | ||
20 | */ | ||
21 | #[AsMessageHandler] | ||
22 | class EarlyExpirationHandler | ||
23 | { | ||
24 | private array $processedNonces = []; | ||
25 | |||
26 | public function __construct( | ||
27 | private ReverseContainer $reverseContainer, | ||
28 | ) { | ||
29 | } | ||
30 | |||
31 | public function __invoke(EarlyExpirationMessage $message): void | ||
32 | { | ||
33 | $item = $message->getItem(); | ||
34 | $metadata = $item->getMetadata(); | ||
35 | $expiry = $metadata[CacheItem::METADATA_EXPIRY] ?? 0; | ||
36 | $ctime = $metadata[CacheItem::METADATA_CTIME] ?? 0; | ||
37 | |||
38 | if ($expiry && $ctime) { | ||
39 | // skip duplicate or expired messages | ||
40 | |||
41 | $processingNonce = [$expiry, $ctime]; | ||
42 | $pool = $message->getPool(); | ||
43 | $key = $item->getKey(); | ||
44 | |||
45 | if (($this->processedNonces[$pool][$key] ?? null) === $processingNonce) { | ||
46 | return; | ||
47 | } | ||
48 | |||
49 | if (microtime(true) >= $expiry) { | ||
50 | return; | ||
51 | } | ||
52 | |||
53 | $this->processedNonces[$pool] = [$key => $processingNonce] + ($this->processedNonces[$pool] ?? []); | ||
54 | |||
55 | if (\count($this->processedNonces[$pool]) > 100) { | ||
56 | array_pop($this->processedNonces[$pool]); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | static $setMetadata; | ||
61 | |||
62 | $setMetadata ??= \Closure::bind( | ||
63 | function (CacheItem $item, float $startTime) { | ||
64 | if ($item->expiry > $endTime = microtime(true)) { | ||
65 | $item->newMetadata[CacheItem::METADATA_EXPIRY] = $item->expiry; | ||
66 | $item->newMetadata[CacheItem::METADATA_CTIME] = (int) ceil(1000 * ($endTime - $startTime)); | ||
67 | } | ||
68 | }, | ||
69 | null, | ||
70 | CacheItem::class | ||
71 | ); | ||
72 | |||
73 | $startTime = microtime(true); | ||
74 | $pool = $message->findPool($this->reverseContainer); | ||
75 | $callback = $message->findCallback($this->reverseContainer); | ||
76 | $save = true; | ||
77 | $value = $callback($item, $save); | ||
78 | $setMetadata($item, $startTime); | ||
79 | $pool->save($item->set($value)); | ||
80 | } | ||
81 | } | ||
diff --git a/vendor/symfony/cache/Messenger/EarlyExpirationMessage.php b/vendor/symfony/cache/Messenger/EarlyExpirationMessage.php new file mode 100644 index 0000000..6056eba --- /dev/null +++ b/vendor/symfony/cache/Messenger/EarlyExpirationMessage.php | |||
@@ -0,0 +1,100 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Messenger; | ||
13 | |||
14 | use Symfony\Component\Cache\Adapter\AdapterInterface; | ||
15 | use Symfony\Component\Cache\CacheItem; | ||
16 | use Symfony\Component\DependencyInjection\ReverseContainer; | ||
17 | |||
18 | /** | ||
19 | * Conveys a cached value that needs to be computed. | ||
20 | */ | ||
21 | final class EarlyExpirationMessage | ||
22 | { | ||
23 | private CacheItem $item; | ||
24 | private string $pool; | ||
25 | private string|array $callback; | ||
26 | |||
27 | public static function create(ReverseContainer $reverseContainer, callable $callback, CacheItem $item, AdapterInterface $pool): ?self | ||
28 | { | ||
29 | try { | ||
30 | $item = clone $item; | ||
31 | $item->set(null); | ||
32 | } catch (\Exception) { | ||
33 | return null; | ||
34 | } | ||
35 | |||
36 | $pool = $reverseContainer->getId($pool); | ||
37 | |||
38 | if (\is_object($callback)) { | ||
39 | if (null === $id = $reverseContainer->getId($callback)) { | ||
40 | return null; | ||
41 | } | ||
42 | |||
43 | $callback = '@'.$id; | ||
44 | } elseif (!\is_array($callback)) { | ||
45 | $callback = (string) $callback; | ||
46 | } elseif (!\is_object($callback[0])) { | ||
47 | $callback = [(string) $callback[0], (string) $callback[1]]; | ||
48 | } else { | ||
49 | if (null === $id = $reverseContainer->getId($callback[0])) { | ||
50 | return null; | ||
51 | } | ||
52 | |||
53 | $callback = ['@'.$id, (string) $callback[1]]; | ||
54 | } | ||
55 | |||
56 | return new self($item, $pool, $callback); | ||
57 | } | ||
58 | |||
59 | public function getItem(): CacheItem | ||
60 | { | ||
61 | return $this->item; | ||
62 | } | ||
63 | |||
64 | public function getPool(): string | ||
65 | { | ||
66 | return $this->pool; | ||
67 | } | ||
68 | |||
69 | /** | ||
70 | * @return string|string[] | ||
71 | */ | ||
72 | public function getCallback(): string|array | ||
73 | { | ||
74 | return $this->callback; | ||
75 | } | ||
76 | |||
77 | public function findPool(ReverseContainer $reverseContainer): AdapterInterface | ||
78 | { | ||
79 | return $reverseContainer->getService($this->pool); | ||
80 | } | ||
81 | |||
82 | public function findCallback(ReverseContainer $reverseContainer): callable | ||
83 | { | ||
84 | if (\is_string($callback = $this->callback)) { | ||
85 | return '@' === $callback[0] ? $reverseContainer->getService(substr($callback, 1)) : $callback; | ||
86 | } | ||
87 | if ('@' === $callback[0][0]) { | ||
88 | $callback[0] = $reverseContainer->getService(substr($callback[0], 1)); | ||
89 | } | ||
90 | |||
91 | return $callback; | ||
92 | } | ||
93 | |||
94 | private function __construct(CacheItem $item, string $pool, string|array $callback) | ||
95 | { | ||
96 | $this->item = $item; | ||
97 | $this->pool = $pool; | ||
98 | $this->callback = $callback; | ||
99 | } | ||
100 | } | ||
diff --git a/vendor/symfony/cache/PruneableInterface.php b/vendor/symfony/cache/PruneableInterface.php new file mode 100644 index 0000000..3095c80 --- /dev/null +++ b/vendor/symfony/cache/PruneableInterface.php | |||
@@ -0,0 +1,20 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache; | ||
13 | |||
14 | /** | ||
15 | * Interface extends psr-6 and psr-16 caches to allow for pruning (deletion) of all expired cache items. | ||
16 | */ | ||
17 | interface PruneableInterface | ||
18 | { | ||
19 | public function prune(): bool; | ||
20 | } | ||
diff --git a/vendor/symfony/cache/Psr16Cache.php b/vendor/symfony/cache/Psr16Cache.php new file mode 100644 index 0000000..f21384f --- /dev/null +++ b/vendor/symfony/cache/Psr16Cache.php | |||
@@ -0,0 +1,240 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache; | ||
13 | |||
14 | use Psr\Cache\CacheException as Psr6CacheException; | ||
15 | use Psr\Cache\CacheItemPoolInterface; | ||
16 | use Psr\SimpleCache\CacheException as SimpleCacheException; | ||
17 | use Psr\SimpleCache\CacheInterface; | ||
18 | use Symfony\Component\Cache\Adapter\AdapterInterface; | ||
19 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
20 | use Symfony\Component\Cache\Traits\ProxyTrait; | ||
21 | |||
22 | /** | ||
23 | * Turns a PSR-6 cache into a PSR-16 one. | ||
24 | * | ||
25 | * @author Nicolas Grekas <p@tchwork.com> | ||
26 | */ | ||
27 | class Psr16Cache implements CacheInterface, PruneableInterface, ResettableInterface | ||
28 | { | ||
29 | use ProxyTrait; | ||
30 | |||
31 | private ?\Closure $createCacheItem = null; | ||
32 | private ?CacheItem $cacheItemPrototype = null; | ||
33 | private static \Closure $packCacheItem; | ||
34 | |||
35 | public function __construct(CacheItemPoolInterface $pool) | ||
36 | { | ||
37 | $this->pool = $pool; | ||
38 | |||
39 | if (!$pool instanceof AdapterInterface) { | ||
40 | return; | ||
41 | } | ||
42 | $cacheItemPrototype = &$this->cacheItemPrototype; | ||
43 | $createCacheItem = \Closure::bind( | ||
44 | static function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) { | ||
45 | $item = clone $cacheItemPrototype; | ||
46 | $item->poolHash = $item->innerItem = null; | ||
47 | if ($allowInt && \is_int($key)) { | ||
48 | $item->key = (string) $key; | ||
49 | } else { | ||
50 | \assert('' !== CacheItem::validateKey($key)); | ||
51 | $item->key = $key; | ||
52 | } | ||
53 | $item->value = $value; | ||
54 | $item->isHit = false; | ||
55 | |||
56 | return $item; | ||
57 | }, | ||
58 | null, | ||
59 | CacheItem::class | ||
60 | ); | ||
61 | $this->createCacheItem = function ($key, $value, $allowInt = false) use ($createCacheItem) { | ||
62 | if (null === $this->cacheItemPrototype) { | ||
63 | $this->get($allowInt && \is_int($key) ? (string) $key : $key); | ||
64 | } | ||
65 | $this->createCacheItem = $createCacheItem; | ||
66 | |||
67 | return $createCacheItem($key, null, $allowInt)->set($value); | ||
68 | }; | ||
69 | self::$packCacheItem ??= \Closure::bind( | ||
70 | static function (CacheItem $item) { | ||
71 | $item->newMetadata = $item->metadata; | ||
72 | |||
73 | return $item->pack(); | ||
74 | }, | ||
75 | null, | ||
76 | CacheItem::class | ||
77 | ); | ||
78 | } | ||
79 | |||
80 | public function get($key, $default = null): mixed | ||
81 | { | ||
82 | try { | ||
83 | $item = $this->pool->getItem($key); | ||
84 | } catch (SimpleCacheException $e) { | ||
85 | throw $e; | ||
86 | } catch (Psr6CacheException $e) { | ||
87 | throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); | ||
88 | } | ||
89 | if (null === $this->cacheItemPrototype) { | ||
90 | $this->cacheItemPrototype = clone $item; | ||
91 | $this->cacheItemPrototype->set(null); | ||
92 | } | ||
93 | |||
94 | return $item->isHit() ? $item->get() : $default; | ||
95 | } | ||
96 | |||
97 | public function set($key, $value, $ttl = null): bool | ||
98 | { | ||
99 | try { | ||
100 | if (null !== $f = $this->createCacheItem) { | ||
101 | $item = $f($key, $value); | ||
102 | } else { | ||
103 | $item = $this->pool->getItem($key)->set($value); | ||
104 | } | ||
105 | } catch (SimpleCacheException $e) { | ||
106 | throw $e; | ||
107 | } catch (Psr6CacheException $e) { | ||
108 | throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); | ||
109 | } | ||
110 | if (null !== $ttl) { | ||
111 | $item->expiresAfter($ttl); | ||
112 | } | ||
113 | |||
114 | return $this->pool->save($item); | ||
115 | } | ||
116 | |||
117 | public function delete($key): bool | ||
118 | { | ||
119 | try { | ||
120 | return $this->pool->deleteItem($key); | ||
121 | } catch (SimpleCacheException $e) { | ||
122 | throw $e; | ||
123 | } catch (Psr6CacheException $e) { | ||
124 | throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | public function clear(): bool | ||
129 | { | ||
130 | return $this->pool->clear(); | ||
131 | } | ||
132 | |||
133 | public function getMultiple($keys, $default = null): iterable | ||
134 | { | ||
135 | if ($keys instanceof \Traversable) { | ||
136 | $keys = iterator_to_array($keys, false); | ||
137 | } elseif (!\is_array($keys)) { | ||
138 | throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', get_debug_type($keys))); | ||
139 | } | ||
140 | |||
141 | try { | ||
142 | $items = $this->pool->getItems($keys); | ||
143 | } catch (SimpleCacheException $e) { | ||
144 | throw $e; | ||
145 | } catch (Psr6CacheException $e) { | ||
146 | throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); | ||
147 | } | ||
148 | $values = []; | ||
149 | |||
150 | if (!$this->pool instanceof AdapterInterface) { | ||
151 | foreach ($items as $key => $item) { | ||
152 | $values[$key] = $item->isHit() ? $item->get() : $default; | ||
153 | } | ||
154 | |||
155 | return $values; | ||
156 | } | ||
157 | |||
158 | foreach ($items as $key => $item) { | ||
159 | $values[$key] = $item->isHit() ? (self::$packCacheItem)($item) : $default; | ||
160 | } | ||
161 | |||
162 | return $values; | ||
163 | } | ||
164 | |||
165 | public function setMultiple($values, $ttl = null): bool | ||
166 | { | ||
167 | $valuesIsArray = \is_array($values); | ||
168 | if (!$valuesIsArray && !$values instanceof \Traversable) { | ||
169 | throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given.', get_debug_type($values))); | ||
170 | } | ||
171 | $items = []; | ||
172 | |||
173 | try { | ||
174 | if (null !== $f = $this->createCacheItem) { | ||
175 | $valuesIsArray = false; | ||
176 | foreach ($values as $key => $value) { | ||
177 | $items[$key] = $f($key, $value, true); | ||
178 | } | ||
179 | } elseif ($valuesIsArray) { | ||
180 | $items = []; | ||
181 | foreach ($values as $key => $value) { | ||
182 | $items[] = (string) $key; | ||
183 | } | ||
184 | $items = $this->pool->getItems($items); | ||
185 | } else { | ||
186 | foreach ($values as $key => $value) { | ||
187 | if (\is_int($key)) { | ||
188 | $key = (string) $key; | ||
189 | } | ||
190 | $items[$key] = $this->pool->getItem($key)->set($value); | ||
191 | } | ||
192 | } | ||
193 | } catch (SimpleCacheException $e) { | ||
194 | throw $e; | ||
195 | } catch (Psr6CacheException $e) { | ||
196 | throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); | ||
197 | } | ||
198 | $ok = true; | ||
199 | |||
200 | foreach ($items as $key => $item) { | ||
201 | if ($valuesIsArray) { | ||
202 | $item->set($values[$key]); | ||
203 | } | ||
204 | if (null !== $ttl) { | ||
205 | $item->expiresAfter($ttl); | ||
206 | } | ||
207 | $ok = $this->pool->saveDeferred($item) && $ok; | ||
208 | } | ||
209 | |||
210 | return $this->pool->commit() && $ok; | ||
211 | } | ||
212 | |||
213 | public function deleteMultiple($keys): bool | ||
214 | { | ||
215 | if ($keys instanceof \Traversable) { | ||
216 | $keys = iterator_to_array($keys, false); | ||
217 | } elseif (!\is_array($keys)) { | ||
218 | throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given.', get_debug_type($keys))); | ||
219 | } | ||
220 | |||
221 | try { | ||
222 | return $this->pool->deleteItems($keys); | ||
223 | } catch (SimpleCacheException $e) { | ||
224 | throw $e; | ||
225 | } catch (Psr6CacheException $e) { | ||
226 | throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); | ||
227 | } | ||
228 | } | ||
229 | |||
230 | public function has($key): bool | ||
231 | { | ||
232 | try { | ||
233 | return $this->pool->hasItem($key); | ||
234 | } catch (SimpleCacheException $e) { | ||
235 | throw $e; | ||
236 | } catch (Psr6CacheException $e) { | ||
237 | throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); | ||
238 | } | ||
239 | } | ||
240 | } | ||
diff --git a/vendor/symfony/cache/README.md b/vendor/symfony/cache/README.md new file mode 100644 index 0000000..c466d57 --- /dev/null +++ b/vendor/symfony/cache/README.md | |||
@@ -0,0 +1,19 @@ | |||
1 | Symfony PSR-6 implementation for caching | ||
2 | ======================================== | ||
3 | |||
4 | The Cache component provides extended | ||
5 | [PSR-6](https://www.php-fig.org/psr/psr-6/) implementations for adding cache to | ||
6 | your applications. It is designed to have a low overhead so that caching is | ||
7 | fastest. It ships with adapters for the most widespread caching backends. | ||
8 | It also provides a [PSR-16](https://www.php-fig.org/psr/psr-16/) adapter, | ||
9 | and implementations for [symfony/cache-contracts](https://github.com/symfony/cache-contracts)' | ||
10 | `CacheInterface` and `TagAwareCacheInterface`. | ||
11 | |||
12 | Resources | ||
13 | --------- | ||
14 | |||
15 | * [Documentation](https://symfony.com/doc/current/components/cache.html) | ||
16 | * [Contributing](https://symfony.com/doc/current/contributing/index.html) | ||
17 | * [Report issues](https://github.com/symfony/symfony/issues) and | ||
18 | [send Pull Requests](https://github.com/symfony/symfony/pulls) | ||
19 | in the [main Symfony repository](https://github.com/symfony/symfony) | ||
diff --git a/vendor/symfony/cache/ResettableInterface.php b/vendor/symfony/cache/ResettableInterface.php new file mode 100644 index 0000000..7b0a853 --- /dev/null +++ b/vendor/symfony/cache/ResettableInterface.php | |||
@@ -0,0 +1,21 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache; | ||
13 | |||
14 | use Symfony\Contracts\Service\ResetInterface; | ||
15 | |||
16 | /** | ||
17 | * Resets a pool's local state. | ||
18 | */ | ||
19 | interface ResettableInterface extends ResetInterface | ||
20 | { | ||
21 | } | ||
diff --git a/vendor/symfony/cache/Traits/AbstractAdapterTrait.php b/vendor/symfony/cache/Traits/AbstractAdapterTrait.php new file mode 100644 index 0000000..222bc54 --- /dev/null +++ b/vendor/symfony/cache/Traits/AbstractAdapterTrait.php | |||
@@ -0,0 +1,377 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | use Psr\Cache\CacheItemInterface; | ||
15 | use Psr\Log\LoggerAwareTrait; | ||
16 | use Symfony\Component\Cache\CacheItem; | ||
17 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
18 | |||
19 | /** | ||
20 | * @author Nicolas Grekas <p@tchwork.com> | ||
21 | * | ||
22 | * @internal | ||
23 | */ | ||
24 | trait AbstractAdapterTrait | ||
25 | { | ||
26 | use LoggerAwareTrait; | ||
27 | |||
28 | /** | ||
29 | * needs to be set by class, signature is function(string <key>, mixed <value>, bool <isHit>). | ||
30 | */ | ||
31 | private static \Closure $createCacheItem; | ||
32 | |||
33 | /** | ||
34 | * needs to be set by class, signature is function(array <deferred>, string <namespace>, array <&expiredIds>). | ||
35 | */ | ||
36 | private static \Closure $mergeByLifetime; | ||
37 | |||
38 | private string $namespace = ''; | ||
39 | private int $defaultLifetime; | ||
40 | private string $namespaceVersion = ''; | ||
41 | private bool $versioningIsEnabled = false; | ||
42 | private array $deferred = []; | ||
43 | private array $ids = []; | ||
44 | |||
45 | /** | ||
46 | * The maximum length to enforce for identifiers or null when no limit applies. | ||
47 | */ | ||
48 | protected ?int $maxIdLength = null; | ||
49 | |||
50 | /** | ||
51 | * Fetches several cache items. | ||
52 | * | ||
53 | * @param array $ids The cache identifiers to fetch | ||
54 | */ | ||
55 | abstract protected function doFetch(array $ids): iterable; | ||
56 | |||
57 | /** | ||
58 | * Confirms if the cache contains specified cache item. | ||
59 | * | ||
60 | * @param string $id The identifier for which to check existence | ||
61 | */ | ||
62 | abstract protected function doHave(string $id): bool; | ||
63 | |||
64 | /** | ||
65 | * Deletes all items in the pool. | ||
66 | * | ||
67 | * @param string $namespace The prefix used for all identifiers managed by this pool | ||
68 | */ | ||
69 | abstract protected function doClear(string $namespace): bool; | ||
70 | |||
71 | /** | ||
72 | * Removes multiple items from the pool. | ||
73 | * | ||
74 | * @param array $ids An array of identifiers that should be removed from the pool | ||
75 | */ | ||
76 | abstract protected function doDelete(array $ids): bool; | ||
77 | |||
78 | /** | ||
79 | * Persists several cache items immediately. | ||
80 | * | ||
81 | * @param array $values The values to cache, indexed by their cache identifier | ||
82 | * @param int $lifetime The lifetime of the cached values, 0 for persisting until manual cleaning | ||
83 | * | ||
84 | * @return array|bool The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ||
85 | */ | ||
86 | abstract protected function doSave(array $values, int $lifetime): array|bool; | ||
87 | |||
88 | public function hasItem(mixed $key): bool | ||
89 | { | ||
90 | $id = $this->getId($key); | ||
91 | |||
92 | if (isset($this->deferred[$key])) { | ||
93 | $this->commit(); | ||
94 | } | ||
95 | |||
96 | try { | ||
97 | return $this->doHave($id); | ||
98 | } catch (\Exception $e) { | ||
99 | CacheItem::log($this->logger, 'Failed to check if key "{key}" is cached: '.$e->getMessage(), ['key' => $key, 'exception' => $e, 'cache-adapter' => get_debug_type($this)]); | ||
100 | |||
101 | return false; | ||
102 | } | ||
103 | } | ||
104 | |||
105 | public function clear(string $prefix = ''): bool | ||
106 | { | ||
107 | $this->deferred = []; | ||
108 | if ($cleared = $this->versioningIsEnabled) { | ||
109 | if ('' === $namespaceVersionToClear = $this->namespaceVersion) { | ||
110 | foreach ($this->doFetch([static::NS_SEPARATOR.$this->namespace]) as $v) { | ||
111 | $namespaceVersionToClear = $v; | ||
112 | } | ||
113 | } | ||
114 | $namespaceToClear = $this->namespace.$namespaceVersionToClear; | ||
115 | $namespaceVersion = self::formatNamespaceVersion(mt_rand()); | ||
116 | try { | ||
117 | $e = $this->doSave([static::NS_SEPARATOR.$this->namespace => $namespaceVersion], 0); | ||
118 | } catch (\Exception $e) { | ||
119 | } | ||
120 | if (true !== $e && [] !== $e) { | ||
121 | $cleared = false; | ||
122 | $message = 'Failed to save the new namespace'.($e instanceof \Exception ? ': '.$e->getMessage() : '.'); | ||
123 | CacheItem::log($this->logger, $message, ['exception' => $e instanceof \Exception ? $e : null, 'cache-adapter' => get_debug_type($this)]); | ||
124 | } else { | ||
125 | $this->namespaceVersion = $namespaceVersion; | ||
126 | $this->ids = []; | ||
127 | } | ||
128 | } else { | ||
129 | $namespaceToClear = $this->namespace.$prefix; | ||
130 | } | ||
131 | |||
132 | try { | ||
133 | return $this->doClear($namespaceToClear) || $cleared; | ||
134 | } catch (\Exception $e) { | ||
135 | CacheItem::log($this->logger, 'Failed to clear the cache: '.$e->getMessage(), ['exception' => $e, 'cache-adapter' => get_debug_type($this)]); | ||
136 | |||
137 | return false; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | public function deleteItem(mixed $key): bool | ||
142 | { | ||
143 | return $this->deleteItems([$key]); | ||
144 | } | ||
145 | |||
146 | public function deleteItems(array $keys): bool | ||
147 | { | ||
148 | $ids = []; | ||
149 | |||
150 | foreach ($keys as $key) { | ||
151 | $ids[$key] = $this->getId($key); | ||
152 | unset($this->deferred[$key]); | ||
153 | } | ||
154 | |||
155 | try { | ||
156 | if ($this->doDelete($ids)) { | ||
157 | return true; | ||
158 | } | ||
159 | } catch (\Exception) { | ||
160 | } | ||
161 | |||
162 | $ok = true; | ||
163 | |||
164 | // When bulk-delete failed, retry each item individually | ||
165 | foreach ($ids as $key => $id) { | ||
166 | try { | ||
167 | $e = null; | ||
168 | if ($this->doDelete([$id])) { | ||
169 | continue; | ||
170 | } | ||
171 | } catch (\Exception $e) { | ||
172 | } | ||
173 | $message = 'Failed to delete key "{key}"'.($e instanceof \Exception ? ': '.$e->getMessage() : '.'); | ||
174 | CacheItem::log($this->logger, $message, ['key' => $key, 'exception' => $e, 'cache-adapter' => get_debug_type($this)]); | ||
175 | $ok = false; | ||
176 | } | ||
177 | |||
178 | return $ok; | ||
179 | } | ||
180 | |||
181 | public function getItem(mixed $key): CacheItem | ||
182 | { | ||
183 | $id = $this->getId($key); | ||
184 | |||
185 | if (isset($this->deferred[$key])) { | ||
186 | $this->commit(); | ||
187 | } | ||
188 | |||
189 | $isHit = false; | ||
190 | $value = null; | ||
191 | |||
192 | try { | ||
193 | foreach ($this->doFetch([$id]) as $value) { | ||
194 | $isHit = true; | ||
195 | } | ||
196 | |||
197 | return (self::$createCacheItem)($key, $value, $isHit); | ||
198 | } catch (\Exception $e) { | ||
199 | CacheItem::log($this->logger, 'Failed to fetch key "{key}": '.$e->getMessage(), ['key' => $key, 'exception' => $e, 'cache-adapter' => get_debug_type($this)]); | ||
200 | } | ||
201 | |||
202 | return (self::$createCacheItem)($key, null, false); | ||
203 | } | ||
204 | |||
205 | public function getItems(array $keys = []): iterable | ||
206 | { | ||
207 | $ids = []; | ||
208 | $commit = false; | ||
209 | |||
210 | foreach ($keys as $key) { | ||
211 | $ids[] = $this->getId($key); | ||
212 | $commit = $commit || isset($this->deferred[$key]); | ||
213 | } | ||
214 | |||
215 | if ($commit) { | ||
216 | $this->commit(); | ||
217 | } | ||
218 | |||
219 | try { | ||
220 | $items = $this->doFetch($ids); | ||
221 | } catch (\Exception $e) { | ||
222 | CacheItem::log($this->logger, 'Failed to fetch items: '.$e->getMessage(), ['keys' => $keys, 'exception' => $e, 'cache-adapter' => get_debug_type($this)]); | ||
223 | $items = []; | ||
224 | } | ||
225 | $ids = array_combine($ids, $keys); | ||
226 | |||
227 | return $this->generateItems($items, $ids); | ||
228 | } | ||
229 | |||
230 | public function save(CacheItemInterface $item): bool | ||
231 | { | ||
232 | if (!$item instanceof CacheItem) { | ||
233 | return false; | ||
234 | } | ||
235 | $this->deferred[$item->getKey()] = $item; | ||
236 | |||
237 | return $this->commit(); | ||
238 | } | ||
239 | |||
240 | public function saveDeferred(CacheItemInterface $item): bool | ||
241 | { | ||
242 | if (!$item instanceof CacheItem) { | ||
243 | return false; | ||
244 | } | ||
245 | $this->deferred[$item->getKey()] = $item; | ||
246 | |||
247 | return true; | ||
248 | } | ||
249 | |||
250 | /** | ||
251 | * Enables/disables versioning of items. | ||
252 | * | ||
253 | * When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, | ||
254 | * but old keys may need garbage collection and extra round-trips to the back-end are required. | ||
255 | * | ||
256 | * Calling this method also clears the memoized namespace version and thus forces a resynchronization of it. | ||
257 | * | ||
258 | * @return bool the previous state of versioning | ||
259 | */ | ||
260 | public function enableVersioning(bool $enable = true): bool | ||
261 | { | ||
262 | $wasEnabled = $this->versioningIsEnabled; | ||
263 | $this->versioningIsEnabled = $enable; | ||
264 | $this->namespaceVersion = ''; | ||
265 | $this->ids = []; | ||
266 | |||
267 | return $wasEnabled; | ||
268 | } | ||
269 | |||
270 | public function reset(): void | ||
271 | { | ||
272 | if ($this->deferred) { | ||
273 | $this->commit(); | ||
274 | } | ||
275 | $this->namespaceVersion = ''; | ||
276 | $this->ids = []; | ||
277 | } | ||
278 | |||
279 | public function __sleep(): array | ||
280 | { | ||
281 | throw new \BadMethodCallException('Cannot serialize '.__CLASS__); | ||
282 | } | ||
283 | |||
284 | public function __wakeup(): void | ||
285 | { | ||
286 | throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); | ||
287 | } | ||
288 | |||
289 | public function __destruct() | ||
290 | { | ||
291 | if ($this->deferred) { | ||
292 | $this->commit(); | ||
293 | } | ||
294 | } | ||
295 | |||
296 | private function generateItems(iterable $items, array &$keys): \Generator | ||
297 | { | ||
298 | $f = self::$createCacheItem; | ||
299 | |||
300 | try { | ||
301 | foreach ($items as $id => $value) { | ||
302 | if (!isset($keys[$id])) { | ||
303 | throw new InvalidArgumentException(sprintf('Could not match value id "%s" to keys "%s".', $id, implode('", "', $keys))); | ||
304 | } | ||
305 | $key = $keys[$id]; | ||
306 | unset($keys[$id]); | ||
307 | yield $key => $f($key, $value, true); | ||
308 | } | ||
309 | } catch (\Exception $e) { | ||
310 | CacheItem::log($this->logger, 'Failed to fetch items: '.$e->getMessage(), ['keys' => array_values($keys), 'exception' => $e, 'cache-adapter' => get_debug_type($this)]); | ||
311 | } | ||
312 | |||
313 | foreach ($keys as $key) { | ||
314 | yield $key => $f($key, null, false); | ||
315 | } | ||
316 | } | ||
317 | |||
318 | /** | ||
319 | * @internal | ||
320 | */ | ||
321 | protected function getId(mixed $key): string | ||
322 | { | ||
323 | if ($this->versioningIsEnabled && '' === $this->namespaceVersion) { | ||
324 | $this->ids = []; | ||
325 | $this->namespaceVersion = '1'.static::NS_SEPARATOR; | ||
326 | try { | ||
327 | foreach ($this->doFetch([static::NS_SEPARATOR.$this->namespace]) as $v) { | ||
328 | $this->namespaceVersion = $v; | ||
329 | } | ||
330 | $e = true; | ||
331 | if ('1'.static::NS_SEPARATOR === $this->namespaceVersion) { | ||
332 | $this->namespaceVersion = self::formatNamespaceVersion(time()); | ||
333 | $e = $this->doSave([static::NS_SEPARATOR.$this->namespace => $this->namespaceVersion], 0); | ||
334 | } | ||
335 | } catch (\Exception $e) { | ||
336 | } | ||
337 | if (true !== $e && [] !== $e) { | ||
338 | $message = 'Failed to save the new namespace'.($e instanceof \Exception ? ': '.$e->getMessage() : '.'); | ||
339 | CacheItem::log($this->logger, $message, ['exception' => $e instanceof \Exception ? $e : null, 'cache-adapter' => get_debug_type($this)]); | ||
340 | } | ||
341 | } | ||
342 | |||
343 | if (\is_string($key) && isset($this->ids[$key])) { | ||
344 | return $this->namespace.$this->namespaceVersion.$this->ids[$key]; | ||
345 | } | ||
346 | \assert('' !== CacheItem::validateKey($key)); | ||
347 | $this->ids[$key] = $key; | ||
348 | |||
349 | if (\count($this->ids) > 1000) { | ||
350 | $this->ids = \array_slice($this->ids, 500, null, true); // stop memory leak if there are many keys | ||
351 | } | ||
352 | |||
353 | if (null === $this->maxIdLength) { | ||
354 | return $this->namespace.$this->namespaceVersion.$key; | ||
355 | } | ||
356 | if (\strlen($id = $this->namespace.$this->namespaceVersion.$key) > $this->maxIdLength) { | ||
357 | // Use xxh128 to favor speed over security, which is not an issue here | ||
358 | $this->ids[$key] = $id = substr_replace(base64_encode(hash('xxh128', $key, true)), static::NS_SEPARATOR, -(\strlen($this->namespaceVersion) + 2)); | ||
359 | $id = $this->namespace.$this->namespaceVersion.$id; | ||
360 | } | ||
361 | |||
362 | return $id; | ||
363 | } | ||
364 | |||
365 | /** | ||
366 | * @internal | ||
367 | */ | ||
368 | public static function handleUnserializeCallback(string $class): never | ||
369 | { | ||
370 | throw new \DomainException('Class not found: '.$class); | ||
371 | } | ||
372 | |||
373 | private static function formatNamespaceVersion(int $value): string | ||
374 | { | ||
375 | return strtr(substr_replace(base64_encode(pack('V', $value)), static::NS_SEPARATOR, 5), '/', '_'); | ||
376 | } | ||
377 | } | ||
diff --git a/vendor/symfony/cache/Traits/ContractsTrait.php b/vendor/symfony/cache/Traits/ContractsTrait.php new file mode 100644 index 0000000..8d830f0 --- /dev/null +++ b/vendor/symfony/cache/Traits/ContractsTrait.php | |||
@@ -0,0 +1,113 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | use Psr\Log\LoggerInterface; | ||
15 | use Symfony\Component\Cache\Adapter\AdapterInterface; | ||
16 | use Symfony\Component\Cache\CacheItem; | ||
17 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
18 | use Symfony\Component\Cache\LockRegistry; | ||
19 | use Symfony\Contracts\Cache\CacheInterface; | ||
20 | use Symfony\Contracts\Cache\CacheTrait; | ||
21 | use Symfony\Contracts\Cache\ItemInterface; | ||
22 | |||
23 | /** | ||
24 | * @author Nicolas Grekas <p@tchwork.com> | ||
25 | * | ||
26 | * @internal | ||
27 | */ | ||
28 | trait ContractsTrait | ||
29 | { | ||
30 | use CacheTrait { | ||
31 | doGet as private contractsGet; | ||
32 | } | ||
33 | |||
34 | private \Closure $callbackWrapper; | ||
35 | private array $computing = []; | ||
36 | |||
37 | /** | ||
38 | * Wraps the callback passed to ->get() in a callable. | ||
39 | * | ||
40 | * @return callable the previous callback wrapper | ||
41 | */ | ||
42 | public function setCallbackWrapper(?callable $callbackWrapper): callable | ||
43 | { | ||
44 | if (!isset($this->callbackWrapper)) { | ||
45 | $this->callbackWrapper = LockRegistry::compute(...); | ||
46 | |||
47 | if (\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) { | ||
48 | $this->setCallbackWrapper(null); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | if (null !== $callbackWrapper && !$callbackWrapper instanceof \Closure) { | ||
53 | $callbackWrapper = $callbackWrapper(...); | ||
54 | } | ||
55 | |||
56 | $previousWrapper = $this->callbackWrapper; | ||
57 | $this->callbackWrapper = $callbackWrapper ?? static fn (callable $callback, ItemInterface $item, bool &$save, CacheInterface $pool, \Closure $setMetadata, ?LoggerInterface $logger) => $callback($item, $save); | ||
58 | |||
59 | return $previousWrapper; | ||
60 | } | ||
61 | |||
62 | private function doGet(AdapterInterface $pool, string $key, callable $callback, ?float $beta, ?array &$metadata = null): mixed | ||
63 | { | ||
64 | if (0 > $beta ??= 1.0) { | ||
65 | throw new InvalidArgumentException(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', static::class, $beta)); | ||
66 | } | ||
67 | |||
68 | static $setMetadata; | ||
69 | |||
70 | $setMetadata ??= \Closure::bind( | ||
71 | static function (CacheItem $item, float $startTime, ?array &$metadata) { | ||
72 | if ($item->expiry > $endTime = microtime(true)) { | ||
73 | $item->newMetadata[CacheItem::METADATA_EXPIRY] = $metadata[CacheItem::METADATA_EXPIRY] = $item->expiry; | ||
74 | $item->newMetadata[CacheItem::METADATA_CTIME] = $metadata[CacheItem::METADATA_CTIME] = (int) ceil(1000 * ($endTime - $startTime)); | ||
75 | } else { | ||
76 | unset($metadata[CacheItem::METADATA_EXPIRY], $metadata[CacheItem::METADATA_CTIME], $metadata[CacheItem::METADATA_TAGS]); | ||
77 | } | ||
78 | }, | ||
79 | null, | ||
80 | CacheItem::class | ||
81 | ); | ||
82 | |||
83 | $this->callbackWrapper ??= LockRegistry::compute(...); | ||
84 | |||
85 | return $this->contractsGet($pool, $key, function (CacheItem $item, bool &$save) use ($pool, $callback, $setMetadata, &$metadata, $key) { | ||
86 | // don't wrap nor save recursive calls | ||
87 | if (isset($this->computing[$key])) { | ||
88 | $value = $callback($item, $save); | ||
89 | $save = false; | ||
90 | |||
91 | return $value; | ||
92 | } | ||
93 | |||
94 | $this->computing[$key] = $key; | ||
95 | $startTime = microtime(true); | ||
96 | |||
97 | if (!isset($this->callbackWrapper)) { | ||
98 | $this->setCallbackWrapper($this->setCallbackWrapper(null)); | ||
99 | } | ||
100 | |||
101 | try { | ||
102 | $value = ($this->callbackWrapper)($callback, $item, $save, $pool, function (CacheItem $item) use ($setMetadata, $startTime, &$metadata) { | ||
103 | $setMetadata($item, $startTime, $metadata); | ||
104 | }, $this->logger ?? null); | ||
105 | $setMetadata($item, $startTime, $metadata); | ||
106 | |||
107 | return $value; | ||
108 | } finally { | ||
109 | unset($this->computing[$key]); | ||
110 | } | ||
111 | }, $beta, $metadata, $this->logger ?? null); | ||
112 | } | ||
113 | } | ||
diff --git a/vendor/symfony/cache/Traits/FilesystemCommonTrait.php b/vendor/symfony/cache/Traits/FilesystemCommonTrait.php new file mode 100644 index 0000000..3e8c3b1 --- /dev/null +++ b/vendor/symfony/cache/Traits/FilesystemCommonTrait.php | |||
@@ -0,0 +1,191 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
15 | |||
16 | /** | ||
17 | * @author Nicolas Grekas <p@tchwork.com> | ||
18 | * | ||
19 | * @internal | ||
20 | */ | ||
21 | trait FilesystemCommonTrait | ||
22 | { | ||
23 | private string $directory; | ||
24 | private string $tmpSuffix; | ||
25 | |||
26 | private function init(string $namespace, ?string $directory): void | ||
27 | { | ||
28 | if (!isset($directory[0])) { | ||
29 | $directory = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'symfony-cache'; | ||
30 | } else { | ||
31 | $directory = realpath($directory) ?: $directory; | ||
32 | } | ||
33 | if (isset($namespace[0])) { | ||
34 | if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) { | ||
35 | throw new InvalidArgumentException(sprintf('Namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0])); | ||
36 | } | ||
37 | $directory .= \DIRECTORY_SEPARATOR.$namespace; | ||
38 | } else { | ||
39 | $directory .= \DIRECTORY_SEPARATOR.'@'; | ||
40 | } | ||
41 | if (!is_dir($directory)) { | ||
42 | @mkdir($directory, 0777, true); | ||
43 | } | ||
44 | $directory .= \DIRECTORY_SEPARATOR; | ||
45 | // On Windows the whole path is limited to 258 chars | ||
46 | if ('\\' === \DIRECTORY_SEPARATOR && \strlen($directory) > 234) { | ||
47 | throw new InvalidArgumentException(sprintf('Cache directory too long (%s).', $directory)); | ||
48 | } | ||
49 | |||
50 | $this->directory = $directory; | ||
51 | } | ||
52 | |||
53 | protected function doClear(string $namespace): bool | ||
54 | { | ||
55 | $ok = true; | ||
56 | |||
57 | foreach ($this->scanHashDir($this->directory) as $file) { | ||
58 | if ('' !== $namespace && !str_starts_with($this->getFileKey($file), $namespace)) { | ||
59 | continue; | ||
60 | } | ||
61 | |||
62 | $ok = ($this->doUnlink($file) || !file_exists($file)) && $ok; | ||
63 | } | ||
64 | |||
65 | return $ok; | ||
66 | } | ||
67 | |||
68 | protected function doDelete(array $ids): bool | ||
69 | { | ||
70 | $ok = true; | ||
71 | |||
72 | foreach ($ids as $id) { | ||
73 | $file = $this->getFile($id); | ||
74 | $ok = (!is_file($file) || $this->doUnlink($file) || !file_exists($file)) && $ok; | ||
75 | } | ||
76 | |||
77 | return $ok; | ||
78 | } | ||
79 | |||
80 | protected function doUnlink(string $file): bool | ||
81 | { | ||
82 | return @unlink($file); | ||
83 | } | ||
84 | |||
85 | private function write(string $file, string $data, ?int $expiresAt = null): bool | ||
86 | { | ||
87 | $unlink = false; | ||
88 | set_error_handler(static fn ($type, $message, $file, $line) => throw new \ErrorException($message, 0, $type, $file, $line)); | ||
89 | try { | ||
90 | $tmp = $this->directory.$this->tmpSuffix ??= str_replace('/', '-', base64_encode(random_bytes(6))); | ||
91 | try { | ||
92 | $h = fopen($tmp, 'x'); | ||
93 | } catch (\ErrorException $e) { | ||
94 | if (!str_contains($e->getMessage(), 'File exists')) { | ||
95 | throw $e; | ||
96 | } | ||
97 | |||
98 | $tmp = $this->directory.$this->tmpSuffix = str_replace('/', '-', base64_encode(random_bytes(6))); | ||
99 | $h = fopen($tmp, 'x'); | ||
100 | } | ||
101 | fwrite($h, $data); | ||
102 | fclose($h); | ||
103 | $unlink = true; | ||
104 | |||
105 | if (null !== $expiresAt) { | ||
106 | touch($tmp, $expiresAt ?: time() + 31556952); // 1 year in seconds | ||
107 | } | ||
108 | |||
109 | if ('\\' === \DIRECTORY_SEPARATOR) { | ||
110 | $success = copy($tmp, $file); | ||
111 | $unlink = true; | ||
112 | } else { | ||
113 | $success = rename($tmp, $file); | ||
114 | $unlink = !$success; | ||
115 | } | ||
116 | |||
117 | return $success; | ||
118 | } finally { | ||
119 | restore_error_handler(); | ||
120 | |||
121 | if ($unlink) { | ||
122 | @unlink($tmp); | ||
123 | } | ||
124 | } | ||
125 | } | ||
126 | |||
127 | private function getFile(string $id, bool $mkdir = false, ?string $directory = null): string | ||
128 | { | ||
129 | // Use xxh128 to favor speed over security, which is not an issue here | ||
130 | $hash = str_replace('/', '-', base64_encode(hash('xxh128', static::class.$id, true))); | ||
131 | $dir = ($directory ?? $this->directory).strtoupper($hash[0].\DIRECTORY_SEPARATOR.$hash[1].\DIRECTORY_SEPARATOR); | ||
132 | |||
133 | if ($mkdir && !is_dir($dir)) { | ||
134 | @mkdir($dir, 0777, true); | ||
135 | } | ||
136 | |||
137 | return $dir.substr($hash, 2, 20); | ||
138 | } | ||
139 | |||
140 | private function getFileKey(string $file): string | ||
141 | { | ||
142 | return ''; | ||
143 | } | ||
144 | |||
145 | private function scanHashDir(string $directory): \Generator | ||
146 | { | ||
147 | if (!is_dir($directory)) { | ||
148 | return; | ||
149 | } | ||
150 | |||
151 | $chars = '+-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; | ||
152 | |||
153 | for ($i = 0; $i < 38; ++$i) { | ||
154 | if (!is_dir($directory.$chars[$i])) { | ||
155 | continue; | ||
156 | } | ||
157 | |||
158 | for ($j = 0; $j < 38; ++$j) { | ||
159 | if (!is_dir($dir = $directory.$chars[$i].\DIRECTORY_SEPARATOR.$chars[$j])) { | ||
160 | continue; | ||
161 | } | ||
162 | |||
163 | foreach (@scandir($dir, \SCANDIR_SORT_NONE) ?: [] as $file) { | ||
164 | if ('.' !== $file && '..' !== $file) { | ||
165 | yield $dir.\DIRECTORY_SEPARATOR.$file; | ||
166 | } | ||
167 | } | ||
168 | } | ||
169 | } | ||
170 | } | ||
171 | |||
172 | public function __sleep(): array | ||
173 | { | ||
174 | throw new \BadMethodCallException('Cannot serialize '.__CLASS__); | ||
175 | } | ||
176 | |||
177 | public function __wakeup(): void | ||
178 | { | ||
179 | throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); | ||
180 | } | ||
181 | |||
182 | public function __destruct() | ||
183 | { | ||
184 | if (method_exists(parent::class, '__destruct')) { | ||
185 | parent::__destruct(); | ||
186 | } | ||
187 | if (isset($this->tmpSuffix) && is_file($this->directory.$this->tmpSuffix)) { | ||
188 | unlink($this->directory.$this->tmpSuffix); | ||
189 | } | ||
190 | } | ||
191 | } | ||
diff --git a/vendor/symfony/cache/Traits/FilesystemTrait.php b/vendor/symfony/cache/Traits/FilesystemTrait.php new file mode 100644 index 0000000..47e9b83 --- /dev/null +++ b/vendor/symfony/cache/Traits/FilesystemTrait.php | |||
@@ -0,0 +1,113 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | use Symfony\Component\Cache\Exception\CacheException; | ||
15 | use Symfony\Component\Cache\Marshaller\MarshallerInterface; | ||
16 | |||
17 | /** | ||
18 | * @author Nicolas Grekas <p@tchwork.com> | ||
19 | * @author Rob Frawley 2nd <rmf@src.run> | ||
20 | * | ||
21 | * @internal | ||
22 | */ | ||
23 | trait FilesystemTrait | ||
24 | { | ||
25 | use FilesystemCommonTrait; | ||
26 | |||
27 | private MarshallerInterface $marshaller; | ||
28 | |||
29 | public function prune(): bool | ||
30 | { | ||
31 | $time = time(); | ||
32 | $pruned = true; | ||
33 | |||
34 | foreach ($this->scanHashDir($this->directory) as $file) { | ||
35 | if (!$h = @fopen($file, 'r')) { | ||
36 | continue; | ||
37 | } | ||
38 | |||
39 | if (($expiresAt = (int) fgets($h)) && $time >= $expiresAt) { | ||
40 | fclose($h); | ||
41 | $pruned = (@unlink($file) || !file_exists($file)) && $pruned; | ||
42 | } else { | ||
43 | fclose($h); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | return $pruned; | ||
48 | } | ||
49 | |||
50 | protected function doFetch(array $ids): iterable | ||
51 | { | ||
52 | $values = []; | ||
53 | $now = time(); | ||
54 | |||
55 | foreach ($ids as $id) { | ||
56 | $file = $this->getFile($id); | ||
57 | if (!is_file($file) || !$h = @fopen($file, 'r')) { | ||
58 | continue; | ||
59 | } | ||
60 | if (($expiresAt = (int) fgets($h)) && $now >= $expiresAt) { | ||
61 | fclose($h); | ||
62 | @unlink($file); | ||
63 | } else { | ||
64 | $i = rawurldecode(rtrim(fgets($h))); | ||
65 | $value = stream_get_contents($h); | ||
66 | fclose($h); | ||
67 | if ($i === $id) { | ||
68 | $values[$id] = $this->marshaller->unmarshall($value); | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | |||
73 | return $values; | ||
74 | } | ||
75 | |||
76 | protected function doHave(string $id): bool | ||
77 | { | ||
78 | $file = $this->getFile($id); | ||
79 | |||
80 | return is_file($file) && (@filemtime($file) > time() || $this->doFetch([$id])); | ||
81 | } | ||
82 | |||
83 | protected function doSave(array $values, int $lifetime): array|bool | ||
84 | { | ||
85 | $expiresAt = $lifetime ? (time() + $lifetime) : 0; | ||
86 | $values = $this->marshaller->marshall($values, $failed); | ||
87 | |||
88 | foreach ($values as $id => $value) { | ||
89 | if (!$this->write($this->getFile($id, true), $expiresAt."\n".rawurlencode($id)."\n".$value, $expiresAt)) { | ||
90 | $failed[] = $id; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | if ($failed && !is_writable($this->directory)) { | ||
95 | throw new CacheException(sprintf('Cache directory is not writable (%s).', $this->directory)); | ||
96 | } | ||
97 | |||
98 | return $failed; | ||
99 | } | ||
100 | |||
101 | private function getFileKey(string $file): string | ||
102 | { | ||
103 | if (!$h = @fopen($file, 'r')) { | ||
104 | return ''; | ||
105 | } | ||
106 | |||
107 | fgets($h); // expiry | ||
108 | $encodedKey = fgets($h); | ||
109 | fclose($h); | ||
110 | |||
111 | return rawurldecode(rtrim($encodedKey)); | ||
112 | } | ||
113 | } | ||
diff --git a/vendor/symfony/cache/Traits/ProxyTrait.php b/vendor/symfony/cache/Traits/ProxyTrait.php new file mode 100644 index 0000000..ba7c11f --- /dev/null +++ b/vendor/symfony/cache/Traits/ProxyTrait.php | |||
@@ -0,0 +1,37 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | use Symfony\Component\Cache\PruneableInterface; | ||
15 | use Symfony\Contracts\Service\ResetInterface; | ||
16 | |||
17 | /** | ||
18 | * @author Nicolas Grekas <p@tchwork.com> | ||
19 | * | ||
20 | * @internal | ||
21 | */ | ||
22 | trait ProxyTrait | ||
23 | { | ||
24 | private object $pool; | ||
25 | |||
26 | public function prune(): bool | ||
27 | { | ||
28 | return $this->pool instanceof PruneableInterface && $this->pool->prune(); | ||
29 | } | ||
30 | |||
31 | public function reset(): void | ||
32 | { | ||
33 | if ($this->pool instanceof ResetInterface) { | ||
34 | $this->pool->reset(); | ||
35 | } | ||
36 | } | ||
37 | } | ||
diff --git a/vendor/symfony/cache/Traits/Redis5Proxy.php b/vendor/symfony/cache/Traits/Redis5Proxy.php new file mode 100644 index 0000000..0b2794e --- /dev/null +++ b/vendor/symfony/cache/Traits/Redis5Proxy.php | |||
@@ -0,0 +1,1228 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | use Symfony\Component\VarExporter\LazyObjectInterface; | ||
15 | use Symfony\Component\VarExporter\LazyProxyTrait; | ||
16 | use Symfony\Contracts\Service\ResetInterface; | ||
17 | |||
18 | // Help opcache.preload discover always-needed symbols | ||
19 | class_exists(\Symfony\Component\VarExporter\Internal\Hydrator::class); | ||
20 | class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectRegistry::class); | ||
21 | class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectState::class); | ||
22 | |||
23 | /** | ||
24 | * @internal | ||
25 | */ | ||
26 | class Redis5Proxy extends \Redis implements ResetInterface, LazyObjectInterface | ||
27 | { | ||
28 | use LazyProxyTrait { | ||
29 | resetLazyObject as reset; | ||
30 | } | ||
31 | |||
32 | private const LAZY_OBJECT_PROPERTY_SCOPES = []; | ||
33 | |||
34 | public function __construct() | ||
35 | { | ||
36 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->__construct(...\func_get_args()); | ||
37 | } | ||
38 | |||
39 | public function _prefix($key) | ||
40 | { | ||
41 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_prefix(...\func_get_args()); | ||
42 | } | ||
43 | |||
44 | public function _serialize($value) | ||
45 | { | ||
46 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_serialize(...\func_get_args()); | ||
47 | } | ||
48 | |||
49 | public function _unserialize($value) | ||
50 | { | ||
51 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_unserialize(...\func_get_args()); | ||
52 | } | ||
53 | |||
54 | public function _pack($value) | ||
55 | { | ||
56 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_pack(...\func_get_args()); | ||
57 | } | ||
58 | |||
59 | public function _unpack($value) | ||
60 | { | ||
61 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_unpack(...\func_get_args()); | ||
62 | } | ||
63 | |||
64 | public function _compress($value) | ||
65 | { | ||
66 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_compress(...\func_get_args()); | ||
67 | } | ||
68 | |||
69 | public function _uncompress($value) | ||
70 | { | ||
71 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_uncompress(...\func_get_args()); | ||
72 | } | ||
73 | |||
74 | public function acl($subcmd, ...$args) | ||
75 | { | ||
76 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->acl(...\func_get_args()); | ||
77 | } | ||
78 | |||
79 | public function append($key, $value) | ||
80 | { | ||
81 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->append(...\func_get_args()); | ||
82 | } | ||
83 | |||
84 | public function auth(#[\SensitiveParameter] $auth) | ||
85 | { | ||
86 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->auth(...\func_get_args()); | ||
87 | } | ||
88 | |||
89 | public function bgSave() | ||
90 | { | ||
91 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgSave(...\func_get_args()); | ||
92 | } | ||
93 | |||
94 | public function bgrewriteaof() | ||
95 | { | ||
96 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgrewriteaof(...\func_get_args()); | ||
97 | } | ||
98 | |||
99 | public function bitcount($key) | ||
100 | { | ||
101 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitcount(...\func_get_args()); | ||
102 | } | ||
103 | |||
104 | public function bitop($operation, $ret_key, $key, ...$other_keys) | ||
105 | { | ||
106 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitop(...\func_get_args()); | ||
107 | } | ||
108 | |||
109 | public function bitpos($key, $bit, $start = null, $end = null) | ||
110 | { | ||
111 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitpos(...\func_get_args()); | ||
112 | } | ||
113 | |||
114 | public function blPop($key, $timeout_or_key, ...$extra_args) | ||
115 | { | ||
116 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blPop(...\func_get_args()); | ||
117 | } | ||
118 | |||
119 | public function brPop($key, $timeout_or_key, ...$extra_args) | ||
120 | { | ||
121 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->brPop(...\func_get_args()); | ||
122 | } | ||
123 | |||
124 | public function brpoplpush($src, $dst, $timeout) | ||
125 | { | ||
126 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->brpoplpush(...\func_get_args()); | ||
127 | } | ||
128 | |||
129 | public function bzPopMax($key, $timeout_or_key, ...$extra_args) | ||
130 | { | ||
131 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzPopMax(...\func_get_args()); | ||
132 | } | ||
133 | |||
134 | public function bzPopMin($key, $timeout_or_key, ...$extra_args) | ||
135 | { | ||
136 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzPopMin(...\func_get_args()); | ||
137 | } | ||
138 | |||
139 | public function clearLastError() | ||
140 | { | ||
141 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->clearLastError(...\func_get_args()); | ||
142 | } | ||
143 | |||
144 | public function client($cmd, ...$args) | ||
145 | { | ||
146 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->client(...\func_get_args()); | ||
147 | } | ||
148 | |||
149 | public function close() | ||
150 | { | ||
151 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->close(...\func_get_args()); | ||
152 | } | ||
153 | |||
154 | public function command(...$args) | ||
155 | { | ||
156 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->command(...\func_get_args()); | ||
157 | } | ||
158 | |||
159 | public function config($cmd, $key, $value = null) | ||
160 | { | ||
161 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->config(...\func_get_args()); | ||
162 | } | ||
163 | |||
164 | public function connect($host, $port = null, $timeout = null, $retry_interval = null) | ||
165 | { | ||
166 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->connect(...\func_get_args()); | ||
167 | } | ||
168 | |||
169 | public function dbSize() | ||
170 | { | ||
171 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dbSize(...\func_get_args()); | ||
172 | } | ||
173 | |||
174 | public function debug($key) | ||
175 | { | ||
176 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->debug(...\func_get_args()); | ||
177 | } | ||
178 | |||
179 | public function decr($key) | ||
180 | { | ||
181 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->decr(...\func_get_args()); | ||
182 | } | ||
183 | |||
184 | public function decrBy($key, $value) | ||
185 | { | ||
186 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->decrBy(...\func_get_args()); | ||
187 | } | ||
188 | |||
189 | public function del($key, ...$other_keys) | ||
190 | { | ||
191 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->del(...\func_get_args()); | ||
192 | } | ||
193 | |||
194 | public function discard() | ||
195 | { | ||
196 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->discard(...\func_get_args()); | ||
197 | } | ||
198 | |||
199 | public function dump($key) | ||
200 | { | ||
201 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args()); | ||
202 | } | ||
203 | |||
204 | public function echo($msg) | ||
205 | { | ||
206 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->echo(...\func_get_args()); | ||
207 | } | ||
208 | |||
209 | public function eval($script, $args = null, $num_keys = null) | ||
210 | { | ||
211 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->eval(...\func_get_args()); | ||
212 | } | ||
213 | |||
214 | public function evalsha($script_sha, $args = null, $num_keys = null) | ||
215 | { | ||
216 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->evalsha(...\func_get_args()); | ||
217 | } | ||
218 | |||
219 | public function exec() | ||
220 | { | ||
221 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->exec(...\func_get_args()); | ||
222 | } | ||
223 | |||
224 | public function exists($key, ...$other_keys) | ||
225 | { | ||
226 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->exists(...\func_get_args()); | ||
227 | } | ||
228 | |||
229 | public function expire($key, $timeout) | ||
230 | { | ||
231 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expire(...\func_get_args()); | ||
232 | } | ||
233 | |||
234 | public function expireAt($key, $timestamp) | ||
235 | { | ||
236 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expireAt(...\func_get_args()); | ||
237 | } | ||
238 | |||
239 | public function flushAll($async = null) | ||
240 | { | ||
241 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->flushAll(...\func_get_args()); | ||
242 | } | ||
243 | |||
244 | public function flushDB($async = null) | ||
245 | { | ||
246 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->flushDB(...\func_get_args()); | ||
247 | } | ||
248 | |||
249 | public function geoadd($key, $lng, $lat, $member, ...$other_triples) | ||
250 | { | ||
251 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geoadd(...\func_get_args()); | ||
252 | } | ||
253 | |||
254 | public function geodist($key, $src, $dst, $unit = null) | ||
255 | { | ||
256 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geodist(...\func_get_args()); | ||
257 | } | ||
258 | |||
259 | public function geohash($key, $member, ...$other_members) | ||
260 | { | ||
261 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geohash(...\func_get_args()); | ||
262 | } | ||
263 | |||
264 | public function geopos($key, $member, ...$other_members) | ||
265 | { | ||
266 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geopos(...\func_get_args()); | ||
267 | } | ||
268 | |||
269 | public function georadius($key, $lng, $lan, $radius, $unit, $opts = null) | ||
270 | { | ||
271 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadius(...\func_get_args()); | ||
272 | } | ||
273 | |||
274 | public function georadius_ro($key, $lng, $lan, $radius, $unit, $opts = null) | ||
275 | { | ||
276 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadius_ro(...\func_get_args()); | ||
277 | } | ||
278 | |||
279 | public function georadiusbymember($key, $member, $radius, $unit, $opts = null) | ||
280 | { | ||
281 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadiusbymember(...\func_get_args()); | ||
282 | } | ||
283 | |||
284 | public function georadiusbymember_ro($key, $member, $radius, $unit, $opts = null) | ||
285 | { | ||
286 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadiusbymember_ro(...\func_get_args()); | ||
287 | } | ||
288 | |||
289 | public function get($key) | ||
290 | { | ||
291 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->get(...\func_get_args()); | ||
292 | } | ||
293 | |||
294 | public function getAuth() | ||
295 | { | ||
296 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getAuth(...\func_get_args()); | ||
297 | } | ||
298 | |||
299 | public function getBit($key, $offset) | ||
300 | { | ||
301 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getBit(...\func_get_args()); | ||
302 | } | ||
303 | |||
304 | public function getDBNum() | ||
305 | { | ||
306 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getDBNum(...\func_get_args()); | ||
307 | } | ||
308 | |||
309 | public function getHost() | ||
310 | { | ||
311 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getHost(...\func_get_args()); | ||
312 | } | ||
313 | |||
314 | public function getLastError() | ||
315 | { | ||
316 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getLastError(...\func_get_args()); | ||
317 | } | ||
318 | |||
319 | public function getMode() | ||
320 | { | ||
321 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getMode(...\func_get_args()); | ||
322 | } | ||
323 | |||
324 | public function getOption($option) | ||
325 | { | ||
326 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getOption(...\func_get_args()); | ||
327 | } | ||
328 | |||
329 | public function getPersistentID() | ||
330 | { | ||
331 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getPersistentID(...\func_get_args()); | ||
332 | } | ||
333 | |||
334 | public function getPort() | ||
335 | { | ||
336 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getPort(...\func_get_args()); | ||
337 | } | ||
338 | |||
339 | public function getRange($key, $start, $end) | ||
340 | { | ||
341 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getRange(...\func_get_args()); | ||
342 | } | ||
343 | |||
344 | public function getReadTimeout() | ||
345 | { | ||
346 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getReadTimeout(...\func_get_args()); | ||
347 | } | ||
348 | |||
349 | public function getSet($key, $value) | ||
350 | { | ||
351 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getSet(...\func_get_args()); | ||
352 | } | ||
353 | |||
354 | public function getTimeout() | ||
355 | { | ||
356 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getTimeout(...\func_get_args()); | ||
357 | } | ||
358 | |||
359 | public function hDel($key, $member, ...$other_members) | ||
360 | { | ||
361 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hDel(...\func_get_args()); | ||
362 | } | ||
363 | |||
364 | public function hExists($key, $member) | ||
365 | { | ||
366 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hExists(...\func_get_args()); | ||
367 | } | ||
368 | |||
369 | public function hGet($key, $member) | ||
370 | { | ||
371 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hGet(...\func_get_args()); | ||
372 | } | ||
373 | |||
374 | public function hGetAll($key) | ||
375 | { | ||
376 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hGetAll(...\func_get_args()); | ||
377 | } | ||
378 | |||
379 | public function hIncrBy($key, $member, $value) | ||
380 | { | ||
381 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hIncrBy(...\func_get_args()); | ||
382 | } | ||
383 | |||
384 | public function hIncrByFloat($key, $member, $value) | ||
385 | { | ||
386 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hIncrByFloat(...\func_get_args()); | ||
387 | } | ||
388 | |||
389 | public function hKeys($key) | ||
390 | { | ||
391 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hKeys(...\func_get_args()); | ||
392 | } | ||
393 | |||
394 | public function hLen($key) | ||
395 | { | ||
396 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hLen(...\func_get_args()); | ||
397 | } | ||
398 | |||
399 | public function hMget($key, $keys) | ||
400 | { | ||
401 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hMget(...\func_get_args()); | ||
402 | } | ||
403 | |||
404 | public function hMset($key, $pairs) | ||
405 | { | ||
406 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hMset(...\func_get_args()); | ||
407 | } | ||
408 | |||
409 | public function hSet($key, $member, $value) | ||
410 | { | ||
411 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSet(...\func_get_args()); | ||
412 | } | ||
413 | |||
414 | public function hSetNx($key, $member, $value) | ||
415 | { | ||
416 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSetNx(...\func_get_args()); | ||
417 | } | ||
418 | |||
419 | public function hStrLen($key, $member) | ||
420 | { | ||
421 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hStrLen(...\func_get_args()); | ||
422 | } | ||
423 | |||
424 | public function hVals($key) | ||
425 | { | ||
426 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hVals(...\func_get_args()); | ||
427 | } | ||
428 | |||
429 | public function hscan($str_key, &$i_iterator, $str_pattern = null, $i_count = null) | ||
430 | { | ||
431 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hscan($str_key, $i_iterator, ...\array_slice(\func_get_args(), 2)); | ||
432 | } | ||
433 | |||
434 | public function incr($key) | ||
435 | { | ||
436 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incr(...\func_get_args()); | ||
437 | } | ||
438 | |||
439 | public function incrBy($key, $value) | ||
440 | { | ||
441 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incrBy(...\func_get_args()); | ||
442 | } | ||
443 | |||
444 | public function incrByFloat($key, $value) | ||
445 | { | ||
446 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incrByFloat(...\func_get_args()); | ||
447 | } | ||
448 | |||
449 | public function info($option = null) | ||
450 | { | ||
451 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->info(...\func_get_args()); | ||
452 | } | ||
453 | |||
454 | public function isConnected() | ||
455 | { | ||
456 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->isConnected(...\func_get_args()); | ||
457 | } | ||
458 | |||
459 | public function keys($pattern) | ||
460 | { | ||
461 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->keys(...\func_get_args()); | ||
462 | } | ||
463 | |||
464 | public function lInsert($key, $position, $pivot, $value) | ||
465 | { | ||
466 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lInsert(...\func_get_args()); | ||
467 | } | ||
468 | |||
469 | public function lLen($key) | ||
470 | { | ||
471 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lLen(...\func_get_args()); | ||
472 | } | ||
473 | |||
474 | public function lPop($key) | ||
475 | { | ||
476 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lPop(...\func_get_args()); | ||
477 | } | ||
478 | |||
479 | public function lPush($key, $value) | ||
480 | { | ||
481 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lPush(...\func_get_args()); | ||
482 | } | ||
483 | |||
484 | public function lPushx($key, $value) | ||
485 | { | ||
486 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lPushx(...\func_get_args()); | ||
487 | } | ||
488 | |||
489 | public function lSet($key, $index, $value) | ||
490 | { | ||
491 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lSet(...\func_get_args()); | ||
492 | } | ||
493 | |||
494 | public function lastSave() | ||
495 | { | ||
496 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lastSave(...\func_get_args()); | ||
497 | } | ||
498 | |||
499 | public function lindex($key, $index) | ||
500 | { | ||
501 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lindex(...\func_get_args()); | ||
502 | } | ||
503 | |||
504 | public function lrange($key, $start, $end) | ||
505 | { | ||
506 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lrange(...\func_get_args()); | ||
507 | } | ||
508 | |||
509 | public function lrem($key, $value, $count) | ||
510 | { | ||
511 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lrem(...\func_get_args()); | ||
512 | } | ||
513 | |||
514 | public function ltrim($key, $start, $stop) | ||
515 | { | ||
516 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ltrim(...\func_get_args()); | ||
517 | } | ||
518 | |||
519 | public function mget($keys) | ||
520 | { | ||
521 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mget(...\func_get_args()); | ||
522 | } | ||
523 | |||
524 | public function migrate($host, $port, $key, $db, $timeout, $copy = null, $replace = null) | ||
525 | { | ||
526 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->migrate(...\func_get_args()); | ||
527 | } | ||
528 | |||
529 | public function move($key, $dbindex) | ||
530 | { | ||
531 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->move(...\func_get_args()); | ||
532 | } | ||
533 | |||
534 | public function mset($pairs) | ||
535 | { | ||
536 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mset(...\func_get_args()); | ||
537 | } | ||
538 | |||
539 | public function msetnx($pairs) | ||
540 | { | ||
541 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->msetnx(...\func_get_args()); | ||
542 | } | ||
543 | |||
544 | public function multi($mode = null) | ||
545 | { | ||
546 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->multi(...\func_get_args()); | ||
547 | } | ||
548 | |||
549 | public function object($field, $key) | ||
550 | { | ||
551 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->object(...\func_get_args()); | ||
552 | } | ||
553 | |||
554 | public function pconnect($host, $port = null, $timeout = null) | ||
555 | { | ||
556 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pconnect(...\func_get_args()); | ||
557 | } | ||
558 | |||
559 | public function persist($key) | ||
560 | { | ||
561 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->persist(...\func_get_args()); | ||
562 | } | ||
563 | |||
564 | public function pexpire($key, $timestamp) | ||
565 | { | ||
566 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpire(...\func_get_args()); | ||
567 | } | ||
568 | |||
569 | public function pexpireAt($key, $timestamp) | ||
570 | { | ||
571 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpireAt(...\func_get_args()); | ||
572 | } | ||
573 | |||
574 | public function pfadd($key, $elements) | ||
575 | { | ||
576 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfadd(...\func_get_args()); | ||
577 | } | ||
578 | |||
579 | public function pfcount($key) | ||
580 | { | ||
581 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfcount(...\func_get_args()); | ||
582 | } | ||
583 | |||
584 | public function pfmerge($dstkey, $keys) | ||
585 | { | ||
586 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfmerge(...\func_get_args()); | ||
587 | } | ||
588 | |||
589 | public function ping() | ||
590 | { | ||
591 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ping(...\func_get_args()); | ||
592 | } | ||
593 | |||
594 | public function pipeline() | ||
595 | { | ||
596 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pipeline(...\func_get_args()); | ||
597 | } | ||
598 | |||
599 | public function psetex($key, $expire, $value) | ||
600 | { | ||
601 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->psetex(...\func_get_args()); | ||
602 | } | ||
603 | |||
604 | public function psubscribe($patterns, $callback) | ||
605 | { | ||
606 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->psubscribe(...\func_get_args()); | ||
607 | } | ||
608 | |||
609 | public function pttl($key) | ||
610 | { | ||
611 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pttl(...\func_get_args()); | ||
612 | } | ||
613 | |||
614 | public function publish($channel, $message) | ||
615 | { | ||
616 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->publish(...\func_get_args()); | ||
617 | } | ||
618 | |||
619 | public function pubsub($cmd, ...$args) | ||
620 | { | ||
621 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pubsub(...\func_get_args()); | ||
622 | } | ||
623 | |||
624 | public function punsubscribe($pattern, ...$other_patterns) | ||
625 | { | ||
626 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->punsubscribe(...\func_get_args()); | ||
627 | } | ||
628 | |||
629 | public function rPop($key) | ||
630 | { | ||
631 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rPop(...\func_get_args()); | ||
632 | } | ||
633 | |||
634 | public function rPush($key, $value) | ||
635 | { | ||
636 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rPush(...\func_get_args()); | ||
637 | } | ||
638 | |||
639 | public function rPushx($key, $value) | ||
640 | { | ||
641 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rPushx(...\func_get_args()); | ||
642 | } | ||
643 | |||
644 | public function randomKey() | ||
645 | { | ||
646 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->randomKey(...\func_get_args()); | ||
647 | } | ||
648 | |||
649 | public function rawcommand($cmd, ...$args) | ||
650 | { | ||
651 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rawcommand(...\func_get_args()); | ||
652 | } | ||
653 | |||
654 | public function rename($key, $newkey) | ||
655 | { | ||
656 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rename(...\func_get_args()); | ||
657 | } | ||
658 | |||
659 | public function renameNx($key, $newkey) | ||
660 | { | ||
661 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->renameNx(...\func_get_args()); | ||
662 | } | ||
663 | |||
664 | public function restore($ttl, $key, $value) | ||
665 | { | ||
666 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->restore(...\func_get_args()); | ||
667 | } | ||
668 | |||
669 | public function role() | ||
670 | { | ||
671 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->role(...\func_get_args()); | ||
672 | } | ||
673 | |||
674 | public function rpoplpush($src, $dst) | ||
675 | { | ||
676 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpoplpush(...\func_get_args()); | ||
677 | } | ||
678 | |||
679 | public function sAdd($key, $value) | ||
680 | { | ||
681 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sAdd(...\func_get_args()); | ||
682 | } | ||
683 | |||
684 | public function sAddArray($key, $options) | ||
685 | { | ||
686 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sAddArray(...\func_get_args()); | ||
687 | } | ||
688 | |||
689 | public function sDiff($key, ...$other_keys) | ||
690 | { | ||
691 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sDiff(...\func_get_args()); | ||
692 | } | ||
693 | |||
694 | public function sDiffStore($dst, $key, ...$other_keys) | ||
695 | { | ||
696 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sDiffStore(...\func_get_args()); | ||
697 | } | ||
698 | |||
699 | public function sInter($key, ...$other_keys) | ||
700 | { | ||
701 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sInter(...\func_get_args()); | ||
702 | } | ||
703 | |||
704 | public function sInterStore($dst, $key, ...$other_keys) | ||
705 | { | ||
706 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sInterStore(...\func_get_args()); | ||
707 | } | ||
708 | |||
709 | public function sMembers($key) | ||
710 | { | ||
711 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sMembers(...\func_get_args()); | ||
712 | } | ||
713 | |||
714 | public function sMisMember($key, $member, ...$other_members) | ||
715 | { | ||
716 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sMisMember(...\func_get_args()); | ||
717 | } | ||
718 | |||
719 | public function sMove($src, $dst, $value) | ||
720 | { | ||
721 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sMove(...\func_get_args()); | ||
722 | } | ||
723 | |||
724 | public function sPop($key) | ||
725 | { | ||
726 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sPop(...\func_get_args()); | ||
727 | } | ||
728 | |||
729 | public function sRandMember($key, $count = null) | ||
730 | { | ||
731 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sRandMember(...\func_get_args()); | ||
732 | } | ||
733 | |||
734 | public function sUnion($key, ...$other_keys) | ||
735 | { | ||
736 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sUnion(...\func_get_args()); | ||
737 | } | ||
738 | |||
739 | public function sUnionStore($dst, $key, ...$other_keys) | ||
740 | { | ||
741 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sUnionStore(...\func_get_args()); | ||
742 | } | ||
743 | |||
744 | public function save() | ||
745 | { | ||
746 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->save(...\func_get_args()); | ||
747 | } | ||
748 | |||
749 | public function scan(&$i_iterator, $str_pattern = null, $i_count = null) | ||
750 | { | ||
751 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->scan($i_iterator, ...\array_slice(\func_get_args(), 1)); | ||
752 | } | ||
753 | |||
754 | public function scard($key) | ||
755 | { | ||
756 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->scard(...\func_get_args()); | ||
757 | } | ||
758 | |||
759 | public function script($cmd, ...$args) | ||
760 | { | ||
761 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->script(...\func_get_args()); | ||
762 | } | ||
763 | |||
764 | public function select($dbindex) | ||
765 | { | ||
766 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->select(...\func_get_args()); | ||
767 | } | ||
768 | |||
769 | public function set($key, $value, $opts = null) | ||
770 | { | ||
771 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->set(...\func_get_args()); | ||
772 | } | ||
773 | |||
774 | public function setBit($key, $offset, $value) | ||
775 | { | ||
776 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setBit(...\func_get_args()); | ||
777 | } | ||
778 | |||
779 | public function setOption($option, $value) | ||
780 | { | ||
781 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setOption(...\func_get_args()); | ||
782 | } | ||
783 | |||
784 | public function setRange($key, $offset, $value) | ||
785 | { | ||
786 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setRange(...\func_get_args()); | ||
787 | } | ||
788 | |||
789 | public function setex($key, $expire, $value) | ||
790 | { | ||
791 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setex(...\func_get_args()); | ||
792 | } | ||
793 | |||
794 | public function setnx($key, $value) | ||
795 | { | ||
796 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setnx(...\func_get_args()); | ||
797 | } | ||
798 | |||
799 | public function sismember($key, $value) | ||
800 | { | ||
801 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sismember(...\func_get_args()); | ||
802 | } | ||
803 | |||
804 | public function slaveof($host = null, $port = null) | ||
805 | { | ||
806 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->slaveof(...\func_get_args()); | ||
807 | } | ||
808 | |||
809 | public function slowlog($arg, $option = null) | ||
810 | { | ||
811 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->slowlog(...\func_get_args()); | ||
812 | } | ||
813 | |||
814 | public function sort($key, $options = null) | ||
815 | { | ||
816 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sort(...\func_get_args()); | ||
817 | } | ||
818 | |||
819 | public function sortAsc($key, $pattern = null, $get = null, $start = null, $end = null, $getList = null) | ||
820 | { | ||
821 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sortAsc(...\func_get_args()); | ||
822 | } | ||
823 | |||
824 | public function sortAscAlpha($key, $pattern = null, $get = null, $start = null, $end = null, $getList = null) | ||
825 | { | ||
826 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sortAscAlpha(...\func_get_args()); | ||
827 | } | ||
828 | |||
829 | public function sortDesc($key, $pattern = null, $get = null, $start = null, $end = null, $getList = null) | ||
830 | { | ||
831 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sortDesc(...\func_get_args()); | ||
832 | } | ||
833 | |||
834 | public function sortDescAlpha($key, $pattern = null, $get = null, $start = null, $end = null, $getList = null) | ||
835 | { | ||
836 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sortDescAlpha(...\func_get_args()); | ||
837 | } | ||
838 | |||
839 | public function srem($key, $member, ...$other_members) | ||
840 | { | ||
841 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->srem(...\func_get_args()); | ||
842 | } | ||
843 | |||
844 | public function sscan($str_key, &$i_iterator, $str_pattern = null, $i_count = null) | ||
845 | { | ||
846 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sscan($str_key, $i_iterator, ...\array_slice(\func_get_args(), 2)); | ||
847 | } | ||
848 | |||
849 | public function strlen($key) | ||
850 | { | ||
851 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->strlen(...\func_get_args()); | ||
852 | } | ||
853 | |||
854 | public function subscribe($channels, $callback) | ||
855 | { | ||
856 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->subscribe(...\func_get_args()); | ||
857 | } | ||
858 | |||
859 | public function swapdb($srcdb, $dstdb) | ||
860 | { | ||
861 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->swapdb(...\func_get_args()); | ||
862 | } | ||
863 | |||
864 | public function time() | ||
865 | { | ||
866 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->time(...\func_get_args()); | ||
867 | } | ||
868 | |||
869 | public function ttl($key) | ||
870 | { | ||
871 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ttl(...\func_get_args()); | ||
872 | } | ||
873 | |||
874 | public function type($key) | ||
875 | { | ||
876 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->type(...\func_get_args()); | ||
877 | } | ||
878 | |||
879 | public function unlink($key, ...$other_keys) | ||
880 | { | ||
881 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unlink(...\func_get_args()); | ||
882 | } | ||
883 | |||
884 | public function unsubscribe($channel, ...$other_channels) | ||
885 | { | ||
886 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unsubscribe(...\func_get_args()); | ||
887 | } | ||
888 | |||
889 | public function unwatch() | ||
890 | { | ||
891 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unwatch(...\func_get_args()); | ||
892 | } | ||
893 | |||
894 | public function wait($numslaves, $timeout) | ||
895 | { | ||
896 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->wait(...\func_get_args()); | ||
897 | } | ||
898 | |||
899 | public function watch($key, ...$other_keys) | ||
900 | { | ||
901 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->watch(...\func_get_args()); | ||
902 | } | ||
903 | |||
904 | public function xack($str_key, $str_group, $arr_ids) | ||
905 | { | ||
906 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xack(...\func_get_args()); | ||
907 | } | ||
908 | |||
909 | public function xadd($str_key, $str_id, $arr_fields, $i_maxlen = null, $boo_approximate = null) | ||
910 | { | ||
911 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xadd(...\func_get_args()); | ||
912 | } | ||
913 | |||
914 | public function xclaim($str_key, $str_group, $str_consumer, $i_min_idle, $arr_ids, $arr_opts = null) | ||
915 | { | ||
916 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xclaim(...\func_get_args()); | ||
917 | } | ||
918 | |||
919 | public function xdel($str_key, $arr_ids) | ||
920 | { | ||
921 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xdel(...\func_get_args()); | ||
922 | } | ||
923 | |||
924 | public function xgroup($str_operation, $str_key = null, $str_arg1 = null, $str_arg2 = null, $str_arg3 = null) | ||
925 | { | ||
926 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xgroup(...\func_get_args()); | ||
927 | } | ||
928 | |||
929 | public function xinfo($str_cmd, $str_key = null, $str_group = null) | ||
930 | { | ||
931 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xinfo(...\func_get_args()); | ||
932 | } | ||
933 | |||
934 | public function xlen($key) | ||
935 | { | ||
936 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xlen(...\func_get_args()); | ||
937 | } | ||
938 | |||
939 | public function xpending($str_key, $str_group, $str_start = null, $str_end = null, $i_count = null, $str_consumer = null) | ||
940 | { | ||
941 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xpending(...\func_get_args()); | ||
942 | } | ||
943 | |||
944 | public function xrange($str_key, $str_start, $str_end, $i_count = null) | ||
945 | { | ||
946 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xrange(...\func_get_args()); | ||
947 | } | ||
948 | |||
949 | public function xread($arr_streams, $i_count = null, $i_block = null) | ||
950 | { | ||
951 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xread(...\func_get_args()); | ||
952 | } | ||
953 | |||
954 | public function xreadgroup($str_group, $str_consumer, $arr_streams, $i_count = null, $i_block = null) | ||
955 | { | ||
956 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xreadgroup(...\func_get_args()); | ||
957 | } | ||
958 | |||
959 | public function xrevrange($str_key, $str_start, $str_end, $i_count = null) | ||
960 | { | ||
961 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xrevrange(...\func_get_args()); | ||
962 | } | ||
963 | |||
964 | public function xtrim($str_key, $i_maxlen, $boo_approximate = null) | ||
965 | { | ||
966 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xtrim(...\func_get_args()); | ||
967 | } | ||
968 | |||
969 | public function zAdd($key, $score, $value, ...$extra_args) | ||
970 | { | ||
971 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zAdd(...\func_get_args()); | ||
972 | } | ||
973 | |||
974 | public function zCard($key) | ||
975 | { | ||
976 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zCard(...\func_get_args()); | ||
977 | } | ||
978 | |||
979 | public function zCount($key, $min, $max) | ||
980 | { | ||
981 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zCount(...\func_get_args()); | ||
982 | } | ||
983 | |||
984 | public function zIncrBy($key, $value, $member) | ||
985 | { | ||
986 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zIncrBy(...\func_get_args()); | ||
987 | } | ||
988 | |||
989 | public function zLexCount($key, $min, $max) | ||
990 | { | ||
991 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zLexCount(...\func_get_args()); | ||
992 | } | ||
993 | |||
994 | public function zPopMax($key) | ||
995 | { | ||
996 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zPopMax(...\func_get_args()); | ||
997 | } | ||
998 | |||
999 | public function zPopMin($key) | ||
1000 | { | ||
1001 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zPopMin(...\func_get_args()); | ||
1002 | } | ||
1003 | |||
1004 | public function zRange($key, $start, $end, $scores = null) | ||
1005 | { | ||
1006 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRange(...\func_get_args()); | ||
1007 | } | ||
1008 | |||
1009 | public function zRangeByLex($key, $min, $max, $offset = null, $limit = null) | ||
1010 | { | ||
1011 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRangeByLex(...\func_get_args()); | ||
1012 | } | ||
1013 | |||
1014 | public function zRangeByScore($key, $start, $end, $options = null) | ||
1015 | { | ||
1016 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRangeByScore(...\func_get_args()); | ||
1017 | } | ||
1018 | |||
1019 | public function zRank($key, $member) | ||
1020 | { | ||
1021 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRank(...\func_get_args()); | ||
1022 | } | ||
1023 | |||
1024 | public function zRem($key, $member, ...$other_members) | ||
1025 | { | ||
1026 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRem(...\func_get_args()); | ||
1027 | } | ||
1028 | |||
1029 | public function zRemRangeByLex($key, $min, $max) | ||
1030 | { | ||
1031 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRemRangeByLex(...\func_get_args()); | ||
1032 | } | ||
1033 | |||
1034 | public function zRemRangeByRank($key, $start, $end) | ||
1035 | { | ||
1036 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRemRangeByRank(...\func_get_args()); | ||
1037 | } | ||
1038 | |||
1039 | public function zRemRangeByScore($key, $min, $max) | ||
1040 | { | ||
1041 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRemRangeByScore(...\func_get_args()); | ||
1042 | } | ||
1043 | |||
1044 | public function zRevRange($key, $start, $end, $scores = null) | ||
1045 | { | ||
1046 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRevRange(...\func_get_args()); | ||
1047 | } | ||
1048 | |||
1049 | public function zRevRangeByLex($key, $min, $max, $offset = null, $limit = null) | ||
1050 | { | ||
1051 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRevRangeByLex(...\func_get_args()); | ||
1052 | } | ||
1053 | |||
1054 | public function zRevRangeByScore($key, $start, $end, $options = null) | ||
1055 | { | ||
1056 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRevRangeByScore(...\func_get_args()); | ||
1057 | } | ||
1058 | |||
1059 | public function zRevRank($key, $member) | ||
1060 | { | ||
1061 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRevRank(...\func_get_args()); | ||
1062 | } | ||
1063 | |||
1064 | public function zScore($key, $member) | ||
1065 | { | ||
1066 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zScore(...\func_get_args()); | ||
1067 | } | ||
1068 | |||
1069 | public function zinterstore($key, $keys, $weights = null, $aggregate = null) | ||
1070 | { | ||
1071 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zinterstore(...\func_get_args()); | ||
1072 | } | ||
1073 | |||
1074 | public function zscan($str_key, &$i_iterator, $str_pattern = null, $i_count = null) | ||
1075 | { | ||
1076 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscan($str_key, $i_iterator, ...\array_slice(\func_get_args(), 2)); | ||
1077 | } | ||
1078 | |||
1079 | public function zunionstore($key, $keys, $weights = null, $aggregate = null) | ||
1080 | { | ||
1081 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zunionstore(...\func_get_args()); | ||
1082 | } | ||
1083 | |||
1084 | public function delete($key, ...$other_keys) | ||
1085 | { | ||
1086 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->delete(...\func_get_args()); | ||
1087 | } | ||
1088 | |||
1089 | public function evaluate($script, $args = null, $num_keys = null) | ||
1090 | { | ||
1091 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->evaluate(...\func_get_args()); | ||
1092 | } | ||
1093 | |||
1094 | public function evaluateSha($script_sha, $args = null, $num_keys = null) | ||
1095 | { | ||
1096 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->evaluateSha(...\func_get_args()); | ||
1097 | } | ||
1098 | |||
1099 | public function getKeys($pattern) | ||
1100 | { | ||
1101 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getKeys(...\func_get_args()); | ||
1102 | } | ||
1103 | |||
1104 | public function getMultiple($keys) | ||
1105 | { | ||
1106 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getMultiple(...\func_get_args()); | ||
1107 | } | ||
1108 | |||
1109 | public function lGet($key, $index) | ||
1110 | { | ||
1111 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lGet(...\func_get_args()); | ||
1112 | } | ||
1113 | |||
1114 | public function lGetRange($key, $start, $end) | ||
1115 | { | ||
1116 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lGetRange(...\func_get_args()); | ||
1117 | } | ||
1118 | |||
1119 | public function lRemove($key, $value, $count) | ||
1120 | { | ||
1121 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lRemove(...\func_get_args()); | ||
1122 | } | ||
1123 | |||
1124 | public function lSize($key) | ||
1125 | { | ||
1126 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lSize(...\func_get_args()); | ||
1127 | } | ||
1128 | |||
1129 | public function listTrim($key, $start, $stop) | ||
1130 | { | ||
1131 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->listTrim(...\func_get_args()); | ||
1132 | } | ||
1133 | |||
1134 | public function open($host, $port = null, $timeout = null, $retry_interval = null) | ||
1135 | { | ||
1136 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->open(...\func_get_args()); | ||
1137 | } | ||
1138 | |||
1139 | public function popen($host, $port = null, $timeout = null) | ||
1140 | { | ||
1141 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->popen(...\func_get_args()); | ||
1142 | } | ||
1143 | |||
1144 | public function renameKey($key, $newkey) | ||
1145 | { | ||
1146 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->renameKey(...\func_get_args()); | ||
1147 | } | ||
1148 | |||
1149 | public function sContains($key, $value) | ||
1150 | { | ||
1151 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sContains(...\func_get_args()); | ||
1152 | } | ||
1153 | |||
1154 | public function sGetMembers($key) | ||
1155 | { | ||
1156 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sGetMembers(...\func_get_args()); | ||
1157 | } | ||
1158 | |||
1159 | public function sRemove($key, $member, ...$other_members) | ||
1160 | { | ||
1161 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sRemove(...\func_get_args()); | ||
1162 | } | ||
1163 | |||
1164 | public function sSize($key) | ||
1165 | { | ||
1166 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sSize(...\func_get_args()); | ||
1167 | } | ||
1168 | |||
1169 | public function sendEcho($msg) | ||
1170 | { | ||
1171 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sendEcho(...\func_get_args()); | ||
1172 | } | ||
1173 | |||
1174 | public function setTimeout($key, $timeout) | ||
1175 | { | ||
1176 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setTimeout(...\func_get_args()); | ||
1177 | } | ||
1178 | |||
1179 | public function substr($key, $start, $end) | ||
1180 | { | ||
1181 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->substr(...\func_get_args()); | ||
1182 | } | ||
1183 | |||
1184 | public function zDelete($key, $member, ...$other_members) | ||
1185 | { | ||
1186 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zDelete(...\func_get_args()); | ||
1187 | } | ||
1188 | |||
1189 | public function zDeleteRangeByRank($key, $min, $max) | ||
1190 | { | ||
1191 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zDeleteRangeByRank(...\func_get_args()); | ||
1192 | } | ||
1193 | |||
1194 | public function zDeleteRangeByScore($key, $min, $max) | ||
1195 | { | ||
1196 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zDeleteRangeByScore(...\func_get_args()); | ||
1197 | } | ||
1198 | |||
1199 | public function zInter($key, $keys, $weights = null, $aggregate = null) | ||
1200 | { | ||
1201 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zInter(...\func_get_args()); | ||
1202 | } | ||
1203 | |||
1204 | public function zRemove($key, $member, ...$other_members) | ||
1205 | { | ||
1206 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRemove(...\func_get_args()); | ||
1207 | } | ||
1208 | |||
1209 | public function zRemoveRangeByScore($key, $min, $max) | ||
1210 | { | ||
1211 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRemoveRangeByScore(...\func_get_args()); | ||
1212 | } | ||
1213 | |||
1214 | public function zReverseRange($key, $start, $end, $scores = null) | ||
1215 | { | ||
1216 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zReverseRange(...\func_get_args()); | ||
1217 | } | ||
1218 | |||
1219 | public function zSize($key) | ||
1220 | { | ||
1221 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zSize(...\func_get_args()); | ||
1222 | } | ||
1223 | |||
1224 | public function zUnion($key, $keys, $weights = null, $aggregate = null) | ||
1225 | { | ||
1226 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zUnion(...\func_get_args()); | ||
1227 | } | ||
1228 | } | ||
diff --git a/vendor/symfony/cache/Traits/Redis6Proxy.php b/vendor/symfony/cache/Traits/Redis6Proxy.php new file mode 100644 index 0000000..0680404 --- /dev/null +++ b/vendor/symfony/cache/Traits/Redis6Proxy.php | |||
@@ -0,0 +1,1293 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | use Symfony\Component\VarExporter\LazyObjectInterface; | ||
15 | use Symfony\Component\VarExporter\LazyProxyTrait; | ||
16 | use Symfony\Contracts\Service\ResetInterface; | ||
17 | |||
18 | // Help opcache.preload discover always-needed symbols | ||
19 | class_exists(\Symfony\Component\VarExporter\Internal\Hydrator::class); | ||
20 | class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectRegistry::class); | ||
21 | class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectState::class); | ||
22 | |||
23 | /** | ||
24 | * @internal | ||
25 | */ | ||
26 | class Redis6Proxy extends \Redis implements ResetInterface, LazyObjectInterface | ||
27 | { | ||
28 | use LazyProxyTrait { | ||
29 | resetLazyObject as reset; | ||
30 | } | ||
31 | |||
32 | private const LAZY_OBJECT_PROPERTY_SCOPES = []; | ||
33 | |||
34 | public function __construct($options = null) | ||
35 | { | ||
36 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->__construct(...\func_get_args()); | ||
37 | } | ||
38 | |||
39 | public function _compress($value): string | ||
40 | { | ||
41 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_compress(...\func_get_args()); | ||
42 | } | ||
43 | |||
44 | public function _uncompress($value): string | ||
45 | { | ||
46 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_uncompress(...\func_get_args()); | ||
47 | } | ||
48 | |||
49 | public function _prefix($key): string | ||
50 | { | ||
51 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_prefix(...\func_get_args()); | ||
52 | } | ||
53 | |||
54 | public function _serialize($value): string | ||
55 | { | ||
56 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_serialize(...\func_get_args()); | ||
57 | } | ||
58 | |||
59 | public function _unserialize($value): mixed | ||
60 | { | ||
61 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_unserialize(...\func_get_args()); | ||
62 | } | ||
63 | |||
64 | public function _pack($value): string | ||
65 | { | ||
66 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_pack(...\func_get_args()); | ||
67 | } | ||
68 | |||
69 | public function _unpack($value): mixed | ||
70 | { | ||
71 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_unpack(...\func_get_args()); | ||
72 | } | ||
73 | |||
74 | public function acl($subcmd, ...$args): mixed | ||
75 | { | ||
76 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->acl(...\func_get_args()); | ||
77 | } | ||
78 | |||
79 | public function append($key, $value): \Redis|false|int | ||
80 | { | ||
81 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->append(...\func_get_args()); | ||
82 | } | ||
83 | |||
84 | public function auth(#[\SensitiveParameter] $credentials): \Redis|bool | ||
85 | { | ||
86 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->auth(...\func_get_args()); | ||
87 | } | ||
88 | |||
89 | public function bgSave(): \Redis|bool | ||
90 | { | ||
91 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgSave(...\func_get_args()); | ||
92 | } | ||
93 | |||
94 | public function bgrewriteaof(): \Redis|bool | ||
95 | { | ||
96 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgrewriteaof(...\func_get_args()); | ||
97 | } | ||
98 | |||
99 | public function bitcount($key, $start = 0, $end = -1, $bybit = false): \Redis|false|int | ||
100 | { | ||
101 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitcount(...\func_get_args()); | ||
102 | } | ||
103 | |||
104 | public function bitop($operation, $deskey, $srckey, ...$other_keys): \Redis|false|int | ||
105 | { | ||
106 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitop(...\func_get_args()); | ||
107 | } | ||
108 | |||
109 | public function bitpos($key, $bit, $start = 0, $end = -1, $bybit = false): \Redis|false|int | ||
110 | { | ||
111 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitpos(...\func_get_args()); | ||
112 | } | ||
113 | |||
114 | public function blPop($key_or_keys, $timeout_or_key, ...$extra_args): \Redis|array|false|null | ||
115 | { | ||
116 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blPop(...\func_get_args()); | ||
117 | } | ||
118 | |||
119 | public function brPop($key_or_keys, $timeout_or_key, ...$extra_args): \Redis|array|false|null | ||
120 | { | ||
121 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->brPop(...\func_get_args()); | ||
122 | } | ||
123 | |||
124 | public function brpoplpush($src, $dst, $timeout): \Redis|false|string | ||
125 | { | ||
126 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->brpoplpush(...\func_get_args()); | ||
127 | } | ||
128 | |||
129 | public function bzPopMax($key, $timeout_or_key, ...$extra_args): \Redis|array|false | ||
130 | { | ||
131 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzPopMax(...\func_get_args()); | ||
132 | } | ||
133 | |||
134 | public function bzPopMin($key, $timeout_or_key, ...$extra_args): \Redis|array|false | ||
135 | { | ||
136 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzPopMin(...\func_get_args()); | ||
137 | } | ||
138 | |||
139 | public function bzmpop($timeout, $keys, $from, $count = 1): \Redis|array|false|null | ||
140 | { | ||
141 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzmpop(...\func_get_args()); | ||
142 | } | ||
143 | |||
144 | public function zmpop($keys, $from, $count = 1): \Redis|array|false|null | ||
145 | { | ||
146 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zmpop(...\func_get_args()); | ||
147 | } | ||
148 | |||
149 | public function blmpop($timeout, $keys, $from, $count = 1): \Redis|array|false|null | ||
150 | { | ||
151 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blmpop(...\func_get_args()); | ||
152 | } | ||
153 | |||
154 | public function lmpop($keys, $from, $count = 1): \Redis|array|false|null | ||
155 | { | ||
156 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lmpop(...\func_get_args()); | ||
157 | } | ||
158 | |||
159 | public function clearLastError(): bool | ||
160 | { | ||
161 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->clearLastError(...\func_get_args()); | ||
162 | } | ||
163 | |||
164 | public function client($opt, ...$args): mixed | ||
165 | { | ||
166 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->client(...\func_get_args()); | ||
167 | } | ||
168 | |||
169 | public function close(): bool | ||
170 | { | ||
171 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->close(...\func_get_args()); | ||
172 | } | ||
173 | |||
174 | public function command($opt = null, ...$args): mixed | ||
175 | { | ||
176 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->command(...\func_get_args()); | ||
177 | } | ||
178 | |||
179 | public function config($operation, $key_or_settings = null, $value = null): mixed | ||
180 | { | ||
181 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->config(...\func_get_args()); | ||
182 | } | ||
183 | |||
184 | public function connect($host, $port = 6379, $timeout = 0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0, $context = null): bool | ||
185 | { | ||
186 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->connect(...\func_get_args()); | ||
187 | } | ||
188 | |||
189 | public function copy($src, $dst, $options = null): \Redis|bool | ||
190 | { | ||
191 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args()); | ||
192 | } | ||
193 | |||
194 | public function dbSize(): \Redis|false|int | ||
195 | { | ||
196 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dbSize(...\func_get_args()); | ||
197 | } | ||
198 | |||
199 | public function debug($key): \Redis|string | ||
200 | { | ||
201 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->debug(...\func_get_args()); | ||
202 | } | ||
203 | |||
204 | public function decr($key, $by = 1): \Redis|false|int | ||
205 | { | ||
206 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->decr(...\func_get_args()); | ||
207 | } | ||
208 | |||
209 | public function decrBy($key, $value): \Redis|false|int | ||
210 | { | ||
211 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->decrBy(...\func_get_args()); | ||
212 | } | ||
213 | |||
214 | public function del($key, ...$other_keys): \Redis|false|int | ||
215 | { | ||
216 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->del(...\func_get_args()); | ||
217 | } | ||
218 | |||
219 | public function delete($key, ...$other_keys): \Redis|false|int | ||
220 | { | ||
221 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->delete(...\func_get_args()); | ||
222 | } | ||
223 | |||
224 | public function discard(): \Redis|bool | ||
225 | { | ||
226 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->discard(...\func_get_args()); | ||
227 | } | ||
228 | |||
229 | public function dump($key): \Redis|string | ||
230 | { | ||
231 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args()); | ||
232 | } | ||
233 | |||
234 | public function echo($str): \Redis|false|string | ||
235 | { | ||
236 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->echo(...\func_get_args()); | ||
237 | } | ||
238 | |||
239 | public function eval($script, $args = [], $num_keys = 0): mixed | ||
240 | { | ||
241 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->eval(...\func_get_args()); | ||
242 | } | ||
243 | |||
244 | public function eval_ro($script_sha, $args = [], $num_keys = 0): mixed | ||
245 | { | ||
246 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->eval_ro(...\func_get_args()); | ||
247 | } | ||
248 | |||
249 | public function evalsha($sha1, $args = [], $num_keys = 0): mixed | ||
250 | { | ||
251 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->evalsha(...\func_get_args()); | ||
252 | } | ||
253 | |||
254 | public function evalsha_ro($sha1, $args = [], $num_keys = 0): mixed | ||
255 | { | ||
256 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->evalsha_ro(...\func_get_args()); | ||
257 | } | ||
258 | |||
259 | public function exec(): \Redis|array|false | ||
260 | { | ||
261 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->exec(...\func_get_args()); | ||
262 | } | ||
263 | |||
264 | public function exists($key, ...$other_keys): \Redis|bool|int | ||
265 | { | ||
266 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->exists(...\func_get_args()); | ||
267 | } | ||
268 | |||
269 | public function expire($key, $timeout, $mode = null): \Redis|bool | ||
270 | { | ||
271 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expire(...\func_get_args()); | ||
272 | } | ||
273 | |||
274 | public function expireAt($key, $timestamp, $mode = null): \Redis|bool | ||
275 | { | ||
276 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expireAt(...\func_get_args()); | ||
277 | } | ||
278 | |||
279 | public function failover($to = null, $abort = false, $timeout = 0): \Redis|bool | ||
280 | { | ||
281 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->failover(...\func_get_args()); | ||
282 | } | ||
283 | |||
284 | public function expiretime($key): \Redis|false|int | ||
285 | { | ||
286 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expiretime(...\func_get_args()); | ||
287 | } | ||
288 | |||
289 | public function pexpiretime($key): \Redis|false|int | ||
290 | { | ||
291 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpiretime(...\func_get_args()); | ||
292 | } | ||
293 | |||
294 | public function fcall($fn, $keys = [], $args = []): mixed | ||
295 | { | ||
296 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->fcall(...\func_get_args()); | ||
297 | } | ||
298 | |||
299 | public function fcall_ro($fn, $keys = [], $args = []): mixed | ||
300 | { | ||
301 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->fcall_ro(...\func_get_args()); | ||
302 | } | ||
303 | |||
304 | public function flushAll($sync = null): \Redis|bool | ||
305 | { | ||
306 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->flushAll(...\func_get_args()); | ||
307 | } | ||
308 | |||
309 | public function flushDB($sync = null): \Redis|bool | ||
310 | { | ||
311 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->flushDB(...\func_get_args()); | ||
312 | } | ||
313 | |||
314 | public function function($operation, ...$args): \Redis|array|bool|string | ||
315 | { | ||
316 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->function(...\func_get_args()); | ||
317 | } | ||
318 | |||
319 | public function geoadd($key, $lng, $lat, $member, ...$other_triples_and_options): \Redis|false|int | ||
320 | { | ||
321 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geoadd(...\func_get_args()); | ||
322 | } | ||
323 | |||
324 | public function geodist($key, $src, $dst, $unit = null): \Redis|false|float | ||
325 | { | ||
326 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geodist(...\func_get_args()); | ||
327 | } | ||
328 | |||
329 | public function geohash($key, $member, ...$other_members): \Redis|array|false | ||
330 | { | ||
331 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geohash(...\func_get_args()); | ||
332 | } | ||
333 | |||
334 | public function geopos($key, $member, ...$other_members): \Redis|array|false | ||
335 | { | ||
336 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geopos(...\func_get_args()); | ||
337 | } | ||
338 | |||
339 | public function georadius($key, $lng, $lat, $radius, $unit, $options = []): mixed | ||
340 | { | ||
341 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadius(...\func_get_args()); | ||
342 | } | ||
343 | |||
344 | public function georadius_ro($key, $lng, $lat, $radius, $unit, $options = []): mixed | ||
345 | { | ||
346 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadius_ro(...\func_get_args()); | ||
347 | } | ||
348 | |||
349 | public function georadiusbymember($key, $member, $radius, $unit, $options = []): mixed | ||
350 | { | ||
351 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadiusbymember(...\func_get_args()); | ||
352 | } | ||
353 | |||
354 | public function georadiusbymember_ro($key, $member, $radius, $unit, $options = []): mixed | ||
355 | { | ||
356 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadiusbymember_ro(...\func_get_args()); | ||
357 | } | ||
358 | |||
359 | public function geosearch($key, $position, $shape, $unit, $options = []): array | ||
360 | { | ||
361 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geosearch(...\func_get_args()); | ||
362 | } | ||
363 | |||
364 | public function geosearchstore($dst, $src, $position, $shape, $unit, $options = []): \Redis|array|false|int | ||
365 | { | ||
366 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geosearchstore(...\func_get_args()); | ||
367 | } | ||
368 | |||
369 | public function get($key): mixed | ||
370 | { | ||
371 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->get(...\func_get_args()); | ||
372 | } | ||
373 | |||
374 | public function getAuth(): mixed | ||
375 | { | ||
376 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getAuth(...\func_get_args()); | ||
377 | } | ||
378 | |||
379 | public function getBit($key, $idx): \Redis|false|int | ||
380 | { | ||
381 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getBit(...\func_get_args()); | ||
382 | } | ||
383 | |||
384 | public function getEx($key, $options = []): \Redis|bool|string | ||
385 | { | ||
386 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getEx(...\func_get_args()); | ||
387 | } | ||
388 | |||
389 | public function getDBNum(): int | ||
390 | { | ||
391 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getDBNum(...\func_get_args()); | ||
392 | } | ||
393 | |||
394 | public function getDel($key): \Redis|bool|string | ||
395 | { | ||
396 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getDel(...\func_get_args()); | ||
397 | } | ||
398 | |||
399 | public function getHost(): string | ||
400 | { | ||
401 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getHost(...\func_get_args()); | ||
402 | } | ||
403 | |||
404 | public function getLastError(): ?string | ||
405 | { | ||
406 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getLastError(...\func_get_args()); | ||
407 | } | ||
408 | |||
409 | public function getMode(): int | ||
410 | { | ||
411 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getMode(...\func_get_args()); | ||
412 | } | ||
413 | |||
414 | public function getOption($option): mixed | ||
415 | { | ||
416 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getOption(...\func_get_args()); | ||
417 | } | ||
418 | |||
419 | public function getPersistentID(): ?string | ||
420 | { | ||
421 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getPersistentID(...\func_get_args()); | ||
422 | } | ||
423 | |||
424 | public function getPort(): int | ||
425 | { | ||
426 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getPort(...\func_get_args()); | ||
427 | } | ||
428 | |||
429 | public function getRange($key, $start, $end): \Redis|false|string | ||
430 | { | ||
431 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getRange(...\func_get_args()); | ||
432 | } | ||
433 | |||
434 | public function lcs($key1, $key2, $options = null): \Redis|array|false|int|string | ||
435 | { | ||
436 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lcs(...\func_get_args()); | ||
437 | } | ||
438 | |||
439 | public function getReadTimeout(): float | ||
440 | { | ||
441 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getReadTimeout(...\func_get_args()); | ||
442 | } | ||
443 | |||
444 | public function getset($key, $value): \Redis|false|string | ||
445 | { | ||
446 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getset(...\func_get_args()); | ||
447 | } | ||
448 | |||
449 | public function getTimeout(): false|float | ||
450 | { | ||
451 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getTimeout(...\func_get_args()); | ||
452 | } | ||
453 | |||
454 | public function getTransferredBytes(): array | ||
455 | { | ||
456 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getTransferredBytes(...\func_get_args()); | ||
457 | } | ||
458 | |||
459 | public function clearTransferredBytes(): void | ||
460 | { | ||
461 | ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->clearTransferredBytes(...\func_get_args()); | ||
462 | } | ||
463 | |||
464 | public function hDel($key, $field, ...$other_fields): \Redis|false|int | ||
465 | { | ||
466 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hDel(...\func_get_args()); | ||
467 | } | ||
468 | |||
469 | public function hExists($key, $field): \Redis|bool | ||
470 | { | ||
471 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hExists(...\func_get_args()); | ||
472 | } | ||
473 | |||
474 | public function hGet($key, $member): mixed | ||
475 | { | ||
476 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hGet(...\func_get_args()); | ||
477 | } | ||
478 | |||
479 | public function hGetAll($key): \Redis|array|false | ||
480 | { | ||
481 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hGetAll(...\func_get_args()); | ||
482 | } | ||
483 | |||
484 | public function hIncrBy($key, $field, $value): \Redis|false|int | ||
485 | { | ||
486 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hIncrBy(...\func_get_args()); | ||
487 | } | ||
488 | |||
489 | public function hIncrByFloat($key, $field, $value): \Redis|false|float | ||
490 | { | ||
491 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hIncrByFloat(...\func_get_args()); | ||
492 | } | ||
493 | |||
494 | public function hKeys($key): \Redis|array|false | ||
495 | { | ||
496 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hKeys(...\func_get_args()); | ||
497 | } | ||
498 | |||
499 | public function hLen($key): \Redis|false|int | ||
500 | { | ||
501 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hLen(...\func_get_args()); | ||
502 | } | ||
503 | |||
504 | public function hMget($key, $fields): \Redis|array|false | ||
505 | { | ||
506 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hMget(...\func_get_args()); | ||
507 | } | ||
508 | |||
509 | public function hMset($key, $fieldvals): \Redis|bool | ||
510 | { | ||
511 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hMset(...\func_get_args()); | ||
512 | } | ||
513 | |||
514 | public function hRandField($key, $options = null): \Redis|array|string | ||
515 | { | ||
516 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hRandField(...\func_get_args()); | ||
517 | } | ||
518 | |||
519 | public function hSet($key, $member, $value): \Redis|false|int | ||
520 | { | ||
521 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSet(...\func_get_args()); | ||
522 | } | ||
523 | |||
524 | public function hSetNx($key, $field, $value): \Redis|bool | ||
525 | { | ||
526 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSetNx(...\func_get_args()); | ||
527 | } | ||
528 | |||
529 | public function hStrLen($key, $field): \Redis|false|int | ||
530 | { | ||
531 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hStrLen(...\func_get_args()); | ||
532 | } | ||
533 | |||
534 | public function hVals($key): \Redis|array|false | ||
535 | { | ||
536 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hVals(...\func_get_args()); | ||
537 | } | ||
538 | |||
539 | public function hscan($key, &$iterator, $pattern = null, $count = 0): \Redis|array|bool | ||
540 | { | ||
541 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hscan($key, $iterator, ...\array_slice(\func_get_args(), 2)); | ||
542 | } | ||
543 | |||
544 | public function incr($key, $by = 1): \Redis|false|int | ||
545 | { | ||
546 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incr(...\func_get_args()); | ||
547 | } | ||
548 | |||
549 | public function incrBy($key, $value): \Redis|false|int | ||
550 | { | ||
551 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incrBy(...\func_get_args()); | ||
552 | } | ||
553 | |||
554 | public function incrByFloat($key, $value): \Redis|false|float | ||
555 | { | ||
556 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incrByFloat(...\func_get_args()); | ||
557 | } | ||
558 | |||
559 | public function info(...$sections): \Redis|array|false | ||
560 | { | ||
561 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->info(...\func_get_args()); | ||
562 | } | ||
563 | |||
564 | public function isConnected(): bool | ||
565 | { | ||
566 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->isConnected(...\func_get_args()); | ||
567 | } | ||
568 | |||
569 | public function keys($pattern) | ||
570 | { | ||
571 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->keys(...\func_get_args()); | ||
572 | } | ||
573 | |||
574 | public function lInsert($key, $pos, $pivot, $value) | ||
575 | { | ||
576 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lInsert(...\func_get_args()); | ||
577 | } | ||
578 | |||
579 | public function lLen($key): \Redis|false|int | ||
580 | { | ||
581 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lLen(...\func_get_args()); | ||
582 | } | ||
583 | |||
584 | public function lMove($src, $dst, $wherefrom, $whereto): \Redis|false|string | ||
585 | { | ||
586 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lMove(...\func_get_args()); | ||
587 | } | ||
588 | |||
589 | public function blmove($src, $dst, $wherefrom, $whereto, $timeout): \Redis|false|string | ||
590 | { | ||
591 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blmove(...\func_get_args()); | ||
592 | } | ||
593 | |||
594 | public function lPop($key, $count = 0): \Redis|array|bool|string | ||
595 | { | ||
596 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lPop(...\func_get_args()); | ||
597 | } | ||
598 | |||
599 | public function lPos($key, $value, $options = null): \Redis|array|bool|int|null | ||
600 | { | ||
601 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lPos(...\func_get_args()); | ||
602 | } | ||
603 | |||
604 | public function lPush($key, ...$elements): \Redis|false|int | ||
605 | { | ||
606 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lPush(...\func_get_args()); | ||
607 | } | ||
608 | |||
609 | public function rPush($key, ...$elements): \Redis|false|int | ||
610 | { | ||
611 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rPush(...\func_get_args()); | ||
612 | } | ||
613 | |||
614 | public function lPushx($key, $value): \Redis|false|int | ||
615 | { | ||
616 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lPushx(...\func_get_args()); | ||
617 | } | ||
618 | |||
619 | public function rPushx($key, $value): \Redis|false|int | ||
620 | { | ||
621 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rPushx(...\func_get_args()); | ||
622 | } | ||
623 | |||
624 | public function lSet($key, $index, $value): \Redis|bool | ||
625 | { | ||
626 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lSet(...\func_get_args()); | ||
627 | } | ||
628 | |||
629 | public function lastSave(): int | ||
630 | { | ||
631 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lastSave(...\func_get_args()); | ||
632 | } | ||
633 | |||
634 | public function lindex($key, $index): mixed | ||
635 | { | ||
636 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lindex(...\func_get_args()); | ||
637 | } | ||
638 | |||
639 | public function lrange($key, $start, $end): \Redis|array|false | ||
640 | { | ||
641 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lrange(...\func_get_args()); | ||
642 | } | ||
643 | |||
644 | public function lrem($key, $value, $count = 0): \Redis|false|int | ||
645 | { | ||
646 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lrem(...\func_get_args()); | ||
647 | } | ||
648 | |||
649 | public function ltrim($key, $start, $end): \Redis|bool | ||
650 | { | ||
651 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ltrim(...\func_get_args()); | ||
652 | } | ||
653 | |||
654 | public function mget($keys): \Redis|array | ||
655 | { | ||
656 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mget(...\func_get_args()); | ||
657 | } | ||
658 | |||
659 | public function migrate($host, $port, $key, $dstdb, $timeout, $copy = false, $replace = false, #[\SensitiveParameter] $credentials = null): \Redis|bool | ||
660 | { | ||
661 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->migrate(...\func_get_args()); | ||
662 | } | ||
663 | |||
664 | public function move($key, $index): \Redis|bool | ||
665 | { | ||
666 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->move(...\func_get_args()); | ||
667 | } | ||
668 | |||
669 | public function mset($key_values): \Redis|bool | ||
670 | { | ||
671 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mset(...\func_get_args()); | ||
672 | } | ||
673 | |||
674 | public function msetnx($key_values): \Redis|bool | ||
675 | { | ||
676 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->msetnx(...\func_get_args()); | ||
677 | } | ||
678 | |||
679 | public function multi($value = \Redis::MULTI): \Redis|bool | ||
680 | { | ||
681 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->multi(...\func_get_args()); | ||
682 | } | ||
683 | |||
684 | public function object($subcommand, $key): \Redis|false|int|string | ||
685 | { | ||
686 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->object(...\func_get_args()); | ||
687 | } | ||
688 | |||
689 | public function open($host, $port = 6379, $timeout = 0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0, $context = null): bool | ||
690 | { | ||
691 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->open(...\func_get_args()); | ||
692 | } | ||
693 | |||
694 | public function pconnect($host, $port = 6379, $timeout = 0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0, $context = null): bool | ||
695 | { | ||
696 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pconnect(...\func_get_args()); | ||
697 | } | ||
698 | |||
699 | public function persist($key): \Redis|bool | ||
700 | { | ||
701 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->persist(...\func_get_args()); | ||
702 | } | ||
703 | |||
704 | public function pexpire($key, $timeout, $mode = null): bool | ||
705 | { | ||
706 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpire(...\func_get_args()); | ||
707 | } | ||
708 | |||
709 | public function pexpireAt($key, $timestamp, $mode = null): \Redis|bool | ||
710 | { | ||
711 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpireAt(...\func_get_args()); | ||
712 | } | ||
713 | |||
714 | public function pfadd($key, $elements): \Redis|int | ||
715 | { | ||
716 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfadd(...\func_get_args()); | ||
717 | } | ||
718 | |||
719 | public function pfcount($key_or_keys): \Redis|false|int | ||
720 | { | ||
721 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfcount(...\func_get_args()); | ||
722 | } | ||
723 | |||
724 | public function pfmerge($dst, $srckeys): \Redis|bool | ||
725 | { | ||
726 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfmerge(...\func_get_args()); | ||
727 | } | ||
728 | |||
729 | public function ping($message = null): \Redis|bool|string | ||
730 | { | ||
731 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ping(...\func_get_args()); | ||
732 | } | ||
733 | |||
734 | public function pipeline(): \Redis|bool | ||
735 | { | ||
736 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pipeline(...\func_get_args()); | ||
737 | } | ||
738 | |||
739 | public function popen($host, $port = 6379, $timeout = 0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0, $context = null): bool | ||
740 | { | ||
741 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->popen(...\func_get_args()); | ||
742 | } | ||
743 | |||
744 | public function psetex($key, $expire, $value): \Redis|bool | ||
745 | { | ||
746 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->psetex(...\func_get_args()); | ||
747 | } | ||
748 | |||
749 | public function psubscribe($patterns, $cb): bool | ||
750 | { | ||
751 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->psubscribe(...\func_get_args()); | ||
752 | } | ||
753 | |||
754 | public function pttl($key): \Redis|false|int | ||
755 | { | ||
756 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pttl(...\func_get_args()); | ||
757 | } | ||
758 | |||
759 | public function publish($channel, $message): \Redis|false|int | ||
760 | { | ||
761 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->publish(...\func_get_args()); | ||
762 | } | ||
763 | |||
764 | public function pubsub($command, $arg = null): mixed | ||
765 | { | ||
766 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pubsub(...\func_get_args()); | ||
767 | } | ||
768 | |||
769 | public function punsubscribe($patterns): \Redis|array|bool | ||
770 | { | ||
771 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->punsubscribe(...\func_get_args()); | ||
772 | } | ||
773 | |||
774 | public function rPop($key, $count = 0): \Redis|array|bool|string | ||
775 | { | ||
776 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rPop(...\func_get_args()); | ||
777 | } | ||
778 | |||
779 | public function randomKey(): \Redis|false|string | ||
780 | { | ||
781 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->randomKey(...\func_get_args()); | ||
782 | } | ||
783 | |||
784 | public function rawcommand($command, ...$args): mixed | ||
785 | { | ||
786 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rawcommand(...\func_get_args()); | ||
787 | } | ||
788 | |||
789 | public function rename($old_name, $new_name): \Redis|bool | ||
790 | { | ||
791 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rename(...\func_get_args()); | ||
792 | } | ||
793 | |||
794 | public function renameNx($key_src, $key_dst): \Redis|bool | ||
795 | { | ||
796 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->renameNx(...\func_get_args()); | ||
797 | } | ||
798 | |||
799 | public function restore($key, $ttl, $value, $options = null): \Redis|bool | ||
800 | { | ||
801 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->restore(...\func_get_args()); | ||
802 | } | ||
803 | |||
804 | public function role(): mixed | ||
805 | { | ||
806 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->role(...\func_get_args()); | ||
807 | } | ||
808 | |||
809 | public function rpoplpush($srckey, $dstkey): \Redis|false|string | ||
810 | { | ||
811 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpoplpush(...\func_get_args()); | ||
812 | } | ||
813 | |||
814 | public function sAdd($key, $value, ...$other_values): \Redis|false|int | ||
815 | { | ||
816 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sAdd(...\func_get_args()); | ||
817 | } | ||
818 | |||
819 | public function sAddArray($key, $values): int | ||
820 | { | ||
821 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sAddArray(...\func_get_args()); | ||
822 | } | ||
823 | |||
824 | public function sDiff($key, ...$other_keys): \Redis|array|false | ||
825 | { | ||
826 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sDiff(...\func_get_args()); | ||
827 | } | ||
828 | |||
829 | public function sDiffStore($dst, $key, ...$other_keys): \Redis|false|int | ||
830 | { | ||
831 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sDiffStore(...\func_get_args()); | ||
832 | } | ||
833 | |||
834 | public function sInter($key, ...$other_keys): \Redis|array|false | ||
835 | { | ||
836 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sInter(...\func_get_args()); | ||
837 | } | ||
838 | |||
839 | public function sintercard($keys, $limit = -1): \Redis|false|int | ||
840 | { | ||
841 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sintercard(...\func_get_args()); | ||
842 | } | ||
843 | |||
844 | public function sInterStore($key, ...$other_keys): \Redis|false|int | ||
845 | { | ||
846 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sInterStore(...\func_get_args()); | ||
847 | } | ||
848 | |||
849 | public function sMembers($key): \Redis|array|false | ||
850 | { | ||
851 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sMembers(...\func_get_args()); | ||
852 | } | ||
853 | |||
854 | public function sMisMember($key, $member, ...$other_members): \Redis|array|false | ||
855 | { | ||
856 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sMisMember(...\func_get_args()); | ||
857 | } | ||
858 | |||
859 | public function sMove($src, $dst, $value): \Redis|bool | ||
860 | { | ||
861 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sMove(...\func_get_args()); | ||
862 | } | ||
863 | |||
864 | public function sPop($key, $count = 0): \Redis|array|false|string | ||
865 | { | ||
866 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sPop(...\func_get_args()); | ||
867 | } | ||
868 | |||
869 | public function sRandMember($key, $count = 0): \Redis|array|false|string | ||
870 | { | ||
871 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sRandMember(...\func_get_args()); | ||
872 | } | ||
873 | |||
874 | public function sUnion($key, ...$other_keys): \Redis|array|false | ||
875 | { | ||
876 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sUnion(...\func_get_args()); | ||
877 | } | ||
878 | |||
879 | public function sUnionStore($dst, $key, ...$other_keys): \Redis|false|int | ||
880 | { | ||
881 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sUnionStore(...\func_get_args()); | ||
882 | } | ||
883 | |||
884 | public function save(): \Redis|bool | ||
885 | { | ||
886 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->save(...\func_get_args()); | ||
887 | } | ||
888 | |||
889 | public function scan(&$iterator, $pattern = null, $count = 0, $type = null): array|false | ||
890 | { | ||
891 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->scan($iterator, ...\array_slice(\func_get_args(), 1)); | ||
892 | } | ||
893 | |||
894 | public function scard($key): \Redis|false|int | ||
895 | { | ||
896 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->scard(...\func_get_args()); | ||
897 | } | ||
898 | |||
899 | public function script($command, ...$args): mixed | ||
900 | { | ||
901 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->script(...\func_get_args()); | ||
902 | } | ||
903 | |||
904 | public function select($db): \Redis|bool | ||
905 | { | ||
906 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->select(...\func_get_args()); | ||
907 | } | ||
908 | |||
909 | public function set($key, $value, $options = null): \Redis|bool|string | ||
910 | { | ||
911 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->set(...\func_get_args()); | ||
912 | } | ||
913 | |||
914 | public function setBit($key, $idx, $value): \Redis|false|int | ||
915 | { | ||
916 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setBit(...\func_get_args()); | ||
917 | } | ||
918 | |||
919 | public function setRange($key, $index, $value): \Redis|false|int | ||
920 | { | ||
921 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setRange(...\func_get_args()); | ||
922 | } | ||
923 | |||
924 | public function setOption($option, $value): bool | ||
925 | { | ||
926 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setOption(...\func_get_args()); | ||
927 | } | ||
928 | |||
929 | public function setex($key, $expire, $value) | ||
930 | { | ||
931 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setex(...\func_get_args()); | ||
932 | } | ||
933 | |||
934 | public function setnx($key, $value): \Redis|bool | ||
935 | { | ||
936 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setnx(...\func_get_args()); | ||
937 | } | ||
938 | |||
939 | public function sismember($key, $value): \Redis|bool | ||
940 | { | ||
941 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sismember(...\func_get_args()); | ||
942 | } | ||
943 | |||
944 | public function slaveof($host = null, $port = 6379): \Redis|bool | ||
945 | { | ||
946 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->slaveof(...\func_get_args()); | ||
947 | } | ||
948 | |||
949 | public function replicaof($host = null, $port = 6379): \Redis|bool | ||
950 | { | ||
951 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->replicaof(...\func_get_args()); | ||
952 | } | ||
953 | |||
954 | public function touch($key_or_array, ...$more_keys): \Redis|false|int | ||
955 | { | ||
956 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->touch(...\func_get_args()); | ||
957 | } | ||
958 | |||
959 | public function slowlog($operation, $length = 0): mixed | ||
960 | { | ||
961 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->slowlog(...\func_get_args()); | ||
962 | } | ||
963 | |||
964 | public function sort($key, $options = null): mixed | ||
965 | { | ||
966 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sort(...\func_get_args()); | ||
967 | } | ||
968 | |||
969 | public function sort_ro($key, $options = null): mixed | ||
970 | { | ||
971 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sort_ro(...\func_get_args()); | ||
972 | } | ||
973 | |||
974 | public function sortAsc($key, $pattern = null, $get = null, $offset = -1, $count = -1, $store = null): array | ||
975 | { | ||
976 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sortAsc(...\func_get_args()); | ||
977 | } | ||
978 | |||
979 | public function sortAscAlpha($key, $pattern = null, $get = null, $offset = -1, $count = -1, $store = null): array | ||
980 | { | ||
981 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sortAscAlpha(...\func_get_args()); | ||
982 | } | ||
983 | |||
984 | public function sortDesc($key, $pattern = null, $get = null, $offset = -1, $count = -1, $store = null): array | ||
985 | { | ||
986 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sortDesc(...\func_get_args()); | ||
987 | } | ||
988 | |||
989 | public function sortDescAlpha($key, $pattern = null, $get = null, $offset = -1, $count = -1, $store = null): array | ||
990 | { | ||
991 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sortDescAlpha(...\func_get_args()); | ||
992 | } | ||
993 | |||
994 | public function srem($key, $value, ...$other_values): \Redis|false|int | ||
995 | { | ||
996 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->srem(...\func_get_args()); | ||
997 | } | ||
998 | |||
999 | public function sscan($key, &$iterator, $pattern = null, $count = 0): array|false | ||
1000 | { | ||
1001 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sscan($key, $iterator, ...\array_slice(\func_get_args(), 2)); | ||
1002 | } | ||
1003 | |||
1004 | public function ssubscribe($channels, $cb): bool | ||
1005 | { | ||
1006 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ssubscribe(...\func_get_args()); | ||
1007 | } | ||
1008 | |||
1009 | public function strlen($key): \Redis|false|int | ||
1010 | { | ||
1011 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->strlen(...\func_get_args()); | ||
1012 | } | ||
1013 | |||
1014 | public function subscribe($channels, $cb): bool | ||
1015 | { | ||
1016 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->subscribe(...\func_get_args()); | ||
1017 | } | ||
1018 | |||
1019 | public function sunsubscribe($channels): \Redis|array|bool | ||
1020 | { | ||
1021 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sunsubscribe(...\func_get_args()); | ||
1022 | } | ||
1023 | |||
1024 | public function swapdb($src, $dst): \Redis|bool | ||
1025 | { | ||
1026 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->swapdb(...\func_get_args()); | ||
1027 | } | ||
1028 | |||
1029 | public function time(): \Redis|array | ||
1030 | { | ||
1031 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->time(...\func_get_args()); | ||
1032 | } | ||
1033 | |||
1034 | public function ttl($key): \Redis|false|int | ||
1035 | { | ||
1036 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ttl(...\func_get_args()); | ||
1037 | } | ||
1038 | |||
1039 | public function type($key): \Redis|false|int | ||
1040 | { | ||
1041 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->type(...\func_get_args()); | ||
1042 | } | ||
1043 | |||
1044 | public function unlink($key, ...$other_keys): \Redis|false|int | ||
1045 | { | ||
1046 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unlink(...\func_get_args()); | ||
1047 | } | ||
1048 | |||
1049 | public function unsubscribe($channels): \Redis|array|bool | ||
1050 | { | ||
1051 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unsubscribe(...\func_get_args()); | ||
1052 | } | ||
1053 | |||
1054 | public function unwatch(): \Redis|bool | ||
1055 | { | ||
1056 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unwatch(...\func_get_args()); | ||
1057 | } | ||
1058 | |||
1059 | public function watch($key, ...$other_keys): \Redis|bool | ||
1060 | { | ||
1061 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->watch(...\func_get_args()); | ||
1062 | } | ||
1063 | |||
1064 | public function wait($numreplicas, $timeout): false|int | ||
1065 | { | ||
1066 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->wait(...\func_get_args()); | ||
1067 | } | ||
1068 | |||
1069 | public function xack($key, $group, $ids): false|int | ||
1070 | { | ||
1071 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xack(...\func_get_args()); | ||
1072 | } | ||
1073 | |||
1074 | public function xadd($key, $id, $values, $maxlen = 0, $approx = false, $nomkstream = false): \Redis|false|string | ||
1075 | { | ||
1076 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xadd(...\func_get_args()); | ||
1077 | } | ||
1078 | |||
1079 | public function xautoclaim($key, $group, $consumer, $min_idle, $start, $count = -1, $justid = false): \Redis|array|bool | ||
1080 | { | ||
1081 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xautoclaim(...\func_get_args()); | ||
1082 | } | ||
1083 | |||
1084 | public function xclaim($key, $group, $consumer, $min_idle, $ids, $options): \Redis|array|bool | ||
1085 | { | ||
1086 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xclaim(...\func_get_args()); | ||
1087 | } | ||
1088 | |||
1089 | public function xdel($key, $ids): \Redis|false|int | ||
1090 | { | ||
1091 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xdel(...\func_get_args()); | ||
1092 | } | ||
1093 | |||
1094 | public function xgroup($operation, $key = null, $group = null, $id_or_consumer = null, $mkstream = false, $entries_read = -2): mixed | ||
1095 | { | ||
1096 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xgroup(...\func_get_args()); | ||
1097 | } | ||
1098 | |||
1099 | public function xinfo($operation, $arg1 = null, $arg2 = null, $count = -1): mixed | ||
1100 | { | ||
1101 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xinfo(...\func_get_args()); | ||
1102 | } | ||
1103 | |||
1104 | public function xlen($key): \Redis|false|int | ||
1105 | { | ||
1106 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xlen(...\func_get_args()); | ||
1107 | } | ||
1108 | |||
1109 | public function xpending($key, $group, $start = null, $end = null, $count = -1, $consumer = null): \Redis|array|false | ||
1110 | { | ||
1111 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xpending(...\func_get_args()); | ||
1112 | } | ||
1113 | |||
1114 | public function xrange($key, $start, $end, $count = -1): \Redis|array|bool | ||
1115 | { | ||
1116 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xrange(...\func_get_args()); | ||
1117 | } | ||
1118 | |||
1119 | public function xread($streams, $count = -1, $block = -1): \Redis|array|bool | ||
1120 | { | ||
1121 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xread(...\func_get_args()); | ||
1122 | } | ||
1123 | |||
1124 | public function xreadgroup($group, $consumer, $streams, $count = 1, $block = 1): \Redis|array|bool | ||
1125 | { | ||
1126 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xreadgroup(...\func_get_args()); | ||
1127 | } | ||
1128 | |||
1129 | public function xrevrange($key, $end, $start, $count = -1): \Redis|array|bool | ||
1130 | { | ||
1131 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xrevrange(...\func_get_args()); | ||
1132 | } | ||
1133 | |||
1134 | public function xtrim($key, $threshold, $approx = false, $minid = false, $limit = -1): \Redis|false|int | ||
1135 | { | ||
1136 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xtrim(...\func_get_args()); | ||
1137 | } | ||
1138 | |||
1139 | public function zAdd($key, $score_or_options, ...$more_scores_and_mems): \Redis|false|float|int | ||
1140 | { | ||
1141 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zAdd(...\func_get_args()); | ||
1142 | } | ||
1143 | |||
1144 | public function zCard($key): \Redis|false|int | ||
1145 | { | ||
1146 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zCard(...\func_get_args()); | ||
1147 | } | ||
1148 | |||
1149 | public function zCount($key, $start, $end): \Redis|false|int | ||
1150 | { | ||
1151 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zCount(...\func_get_args()); | ||
1152 | } | ||
1153 | |||
1154 | public function zIncrBy($key, $value, $member): \Redis|false|float | ||
1155 | { | ||
1156 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zIncrBy(...\func_get_args()); | ||
1157 | } | ||
1158 | |||
1159 | public function zLexCount($key, $min, $max): \Redis|false|int | ||
1160 | { | ||
1161 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zLexCount(...\func_get_args()); | ||
1162 | } | ||
1163 | |||
1164 | public function zMscore($key, $member, ...$other_members): \Redis|array|false | ||
1165 | { | ||
1166 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zMscore(...\func_get_args()); | ||
1167 | } | ||
1168 | |||
1169 | public function zPopMax($key, $count = null): \Redis|array|false | ||
1170 | { | ||
1171 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zPopMax(...\func_get_args()); | ||
1172 | } | ||
1173 | |||
1174 | public function zPopMin($key, $count = null): \Redis|array|false | ||
1175 | { | ||
1176 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zPopMin(...\func_get_args()); | ||
1177 | } | ||
1178 | |||
1179 | public function zRange($key, $start, $end, $options = null): \Redis|array|false | ||
1180 | { | ||
1181 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRange(...\func_get_args()); | ||
1182 | } | ||
1183 | |||
1184 | public function zRangeByLex($key, $min, $max, $offset = -1, $count = -1): \Redis|array|false | ||
1185 | { | ||
1186 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRangeByLex(...\func_get_args()); | ||
1187 | } | ||
1188 | |||
1189 | public function zRangeByScore($key, $start, $end, $options = []): \Redis|array|false | ||
1190 | { | ||
1191 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRangeByScore(...\func_get_args()); | ||
1192 | } | ||
1193 | |||
1194 | public function zrangestore($dstkey, $srckey, $start, $end, $options = null): \Redis|false|int | ||
1195 | { | ||
1196 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrangestore(...\func_get_args()); | ||
1197 | } | ||
1198 | |||
1199 | public function zRandMember($key, $options = null): \Redis|array|string | ||
1200 | { | ||
1201 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRandMember(...\func_get_args()); | ||
1202 | } | ||
1203 | |||
1204 | public function zRank($key, $member): \Redis|false|int | ||
1205 | { | ||
1206 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRank(...\func_get_args()); | ||
1207 | } | ||
1208 | |||
1209 | public function zRem($key, $member, ...$other_members): \Redis|false|int | ||
1210 | { | ||
1211 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRem(...\func_get_args()); | ||
1212 | } | ||
1213 | |||
1214 | public function zRemRangeByLex($key, $min, $max): \Redis|false|int | ||
1215 | { | ||
1216 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRemRangeByLex(...\func_get_args()); | ||
1217 | } | ||
1218 | |||
1219 | public function zRemRangeByRank($key, $start, $end): \Redis|false|int | ||
1220 | { | ||
1221 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRemRangeByRank(...\func_get_args()); | ||
1222 | } | ||
1223 | |||
1224 | public function zRemRangeByScore($key, $start, $end): \Redis|false|int | ||
1225 | { | ||
1226 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRemRangeByScore(...\func_get_args()); | ||
1227 | } | ||
1228 | |||
1229 | public function zRevRange($key, $start, $end, $scores = null): \Redis|array|false | ||
1230 | { | ||
1231 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRevRange(...\func_get_args()); | ||
1232 | } | ||
1233 | |||
1234 | public function zRevRangeByLex($key, $max, $min, $offset = -1, $count = -1): \Redis|array|false | ||
1235 | { | ||
1236 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRevRangeByLex(...\func_get_args()); | ||
1237 | } | ||
1238 | |||
1239 | public function zRevRangeByScore($key, $max, $min, $options = []): \Redis|array|false | ||
1240 | { | ||
1241 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRevRangeByScore(...\func_get_args()); | ||
1242 | } | ||
1243 | |||
1244 | public function zRevRank($key, $member): \Redis|false|int | ||
1245 | { | ||
1246 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zRevRank(...\func_get_args()); | ||
1247 | } | ||
1248 | |||
1249 | public function zScore($key, $member): \Redis|false|float | ||
1250 | { | ||
1251 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zScore(...\func_get_args()); | ||
1252 | } | ||
1253 | |||
1254 | public function zdiff($keys, $options = null): \Redis|array|false | ||
1255 | { | ||
1256 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zdiff(...\func_get_args()); | ||
1257 | } | ||
1258 | |||
1259 | public function zdiffstore($dst, $keys): \Redis|false|int | ||
1260 | { | ||
1261 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zdiffstore(...\func_get_args()); | ||
1262 | } | ||
1263 | |||
1264 | public function zinter($keys, $weights = null, $options = null): \Redis|array|false | ||
1265 | { | ||
1266 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zinter(...\func_get_args()); | ||
1267 | } | ||
1268 | |||
1269 | public function zintercard($keys, $limit = -1): \Redis|false|int | ||
1270 | { | ||
1271 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zintercard(...\func_get_args()); | ||
1272 | } | ||
1273 | |||
1274 | public function zinterstore($dst, $keys, $weights = null, $aggregate = null): \Redis|false|int | ||
1275 | { | ||
1276 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zinterstore(...\func_get_args()); | ||
1277 | } | ||
1278 | |||
1279 | public function zscan($key, &$iterator, $pattern = null, $count = 0): \Redis|array|false | ||
1280 | { | ||
1281 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscan($key, $iterator, ...\array_slice(\func_get_args(), 2)); | ||
1282 | } | ||
1283 | |||
1284 | public function zunion($keys, $weights = null, $options = null): \Redis|array|false | ||
1285 | { | ||
1286 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zunion(...\func_get_args()); | ||
1287 | } | ||
1288 | |||
1289 | public function zunionstore($dst, $keys, $weights = null, $aggregate = null): \Redis|false|int | ||
1290 | { | ||
1291 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zunionstore(...\func_get_args()); | ||
1292 | } | ||
1293 | } | ||
diff --git a/vendor/symfony/cache/Traits/RedisCluster5Proxy.php b/vendor/symfony/cache/Traits/RedisCluster5Proxy.php new file mode 100644 index 0000000..511c53d --- /dev/null +++ b/vendor/symfony/cache/Traits/RedisCluster5Proxy.php | |||
@@ -0,0 +1,983 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | use Symfony\Component\VarExporter\LazyObjectInterface; | ||
15 | use Symfony\Component\VarExporter\LazyProxyTrait; | ||
16 | use Symfony\Contracts\Service\ResetInterface; | ||
17 | |||
18 | // Help opcache.preload discover always-needed symbols | ||
19 | class_exists(\Symfony\Component\VarExporter\Internal\Hydrator::class); | ||
20 | class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectRegistry::class); | ||
21 | class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectState::class); | ||
22 | |||
23 | /** | ||
24 | * @internal | ||
25 | */ | ||
26 | class RedisCluster5Proxy extends \RedisCluster implements ResetInterface, LazyObjectInterface | ||
27 | { | ||
28 | use LazyProxyTrait { | ||
29 | resetLazyObject as reset; | ||
30 | } | ||
31 | |||
32 | private const LAZY_OBJECT_PROPERTY_SCOPES = []; | ||
33 | |||
34 | public function __construct($name, $seeds = null, $timeout = null, $read_timeout = null, $persistent = null, #[\SensitiveParameter] $auth = null) | ||
35 | { | ||
36 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->__construct(...\func_get_args()); | ||
37 | } | ||
38 | |||
39 | public function _masters() | ||
40 | { | ||
41 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_masters(...\func_get_args()); | ||
42 | } | ||
43 | |||
44 | public function _prefix($key) | ||
45 | { | ||
46 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_prefix(...\func_get_args()); | ||
47 | } | ||
48 | |||
49 | public function _redir() | ||
50 | { | ||
51 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_redir(...\func_get_args()); | ||
52 | } | ||
53 | |||
54 | public function _serialize($value) | ||
55 | { | ||
56 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_serialize(...\func_get_args()); | ||
57 | } | ||
58 | |||
59 | public function _unserialize($value) | ||
60 | { | ||
61 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_unserialize(...\func_get_args()); | ||
62 | } | ||
63 | |||
64 | public function _compress($value) | ||
65 | { | ||
66 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_compress(...\func_get_args()); | ||
67 | } | ||
68 | |||
69 | public function _uncompress($value) | ||
70 | { | ||
71 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_uncompress(...\func_get_args()); | ||
72 | } | ||
73 | |||
74 | public function _pack($value) | ||
75 | { | ||
76 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_pack(...\func_get_args()); | ||
77 | } | ||
78 | |||
79 | public function _unpack($value) | ||
80 | { | ||
81 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_unpack(...\func_get_args()); | ||
82 | } | ||
83 | |||
84 | public function acl($key_or_address, $subcmd, ...$args) | ||
85 | { | ||
86 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->acl(...\func_get_args()); | ||
87 | } | ||
88 | |||
89 | public function append($key, $value) | ||
90 | { | ||
91 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->append(...\func_get_args()); | ||
92 | } | ||
93 | |||
94 | public function bgrewriteaof($key_or_address) | ||
95 | { | ||
96 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgrewriteaof(...\func_get_args()); | ||
97 | } | ||
98 | |||
99 | public function bgsave($key_or_address) | ||
100 | { | ||
101 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgsave(...\func_get_args()); | ||
102 | } | ||
103 | |||
104 | public function bitcount($key) | ||
105 | { | ||
106 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitcount(...\func_get_args()); | ||
107 | } | ||
108 | |||
109 | public function bitop($operation, $ret_key, $key, ...$other_keys) | ||
110 | { | ||
111 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitop(...\func_get_args()); | ||
112 | } | ||
113 | |||
114 | public function bitpos($key, $bit, $start = null, $end = null) | ||
115 | { | ||
116 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitpos(...\func_get_args()); | ||
117 | } | ||
118 | |||
119 | public function blpop($key, $timeout_or_key, ...$extra_args) | ||
120 | { | ||
121 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blpop(...\func_get_args()); | ||
122 | } | ||
123 | |||
124 | public function brpop($key, $timeout_or_key, ...$extra_args) | ||
125 | { | ||
126 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->brpop(...\func_get_args()); | ||
127 | } | ||
128 | |||
129 | public function brpoplpush($src, $dst, $timeout) | ||
130 | { | ||
131 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->brpoplpush(...\func_get_args()); | ||
132 | } | ||
133 | |||
134 | public function clearlasterror() | ||
135 | { | ||
136 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->clearlasterror(...\func_get_args()); | ||
137 | } | ||
138 | |||
139 | public function bzpopmax($key, $timeout_or_key, ...$extra_args) | ||
140 | { | ||
141 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzpopmax(...\func_get_args()); | ||
142 | } | ||
143 | |||
144 | public function bzpopmin($key, $timeout_or_key, ...$extra_args) | ||
145 | { | ||
146 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzpopmin(...\func_get_args()); | ||
147 | } | ||
148 | |||
149 | public function client($key_or_address, $arg = null, ...$other_args) | ||
150 | { | ||
151 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->client(...\func_get_args()); | ||
152 | } | ||
153 | |||
154 | public function close() | ||
155 | { | ||
156 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->close(...\func_get_args()); | ||
157 | } | ||
158 | |||
159 | public function cluster($key_or_address, $arg = null, ...$other_args) | ||
160 | { | ||
161 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cluster(...\func_get_args()); | ||
162 | } | ||
163 | |||
164 | public function command(...$args) | ||
165 | { | ||
166 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->command(...\func_get_args()); | ||
167 | } | ||
168 | |||
169 | public function config($key_or_address, $arg = null, ...$other_args) | ||
170 | { | ||
171 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->config(...\func_get_args()); | ||
172 | } | ||
173 | |||
174 | public function dbsize($key_or_address) | ||
175 | { | ||
176 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dbsize(...\func_get_args()); | ||
177 | } | ||
178 | |||
179 | public function decr($key) | ||
180 | { | ||
181 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->decr(...\func_get_args()); | ||
182 | } | ||
183 | |||
184 | public function decrby($key, $value) | ||
185 | { | ||
186 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->decrby(...\func_get_args()); | ||
187 | } | ||
188 | |||
189 | public function del($key, ...$other_keys) | ||
190 | { | ||
191 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->del(...\func_get_args()); | ||
192 | } | ||
193 | |||
194 | public function discard() | ||
195 | { | ||
196 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->discard(...\func_get_args()); | ||
197 | } | ||
198 | |||
199 | public function dump($key) | ||
200 | { | ||
201 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args()); | ||
202 | } | ||
203 | |||
204 | public function echo($msg) | ||
205 | { | ||
206 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->echo(...\func_get_args()); | ||
207 | } | ||
208 | |||
209 | public function eval($script, $args = null, $num_keys = null) | ||
210 | { | ||
211 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->eval(...\func_get_args()); | ||
212 | } | ||
213 | |||
214 | public function evalsha($script_sha, $args = null, $num_keys = null) | ||
215 | { | ||
216 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->evalsha(...\func_get_args()); | ||
217 | } | ||
218 | |||
219 | public function exec() | ||
220 | { | ||
221 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->exec(...\func_get_args()); | ||
222 | } | ||
223 | |||
224 | public function exists($key) | ||
225 | { | ||
226 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->exists(...\func_get_args()); | ||
227 | } | ||
228 | |||
229 | public function expire($key, $timeout) | ||
230 | { | ||
231 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expire(...\func_get_args()); | ||
232 | } | ||
233 | |||
234 | public function expireat($key, $timestamp) | ||
235 | { | ||
236 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expireat(...\func_get_args()); | ||
237 | } | ||
238 | |||
239 | public function flushall($key_or_address, $async = null) | ||
240 | { | ||
241 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->flushall(...\func_get_args()); | ||
242 | } | ||
243 | |||
244 | public function flushdb($key_or_address, $async = null) | ||
245 | { | ||
246 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->flushdb(...\func_get_args()); | ||
247 | } | ||
248 | |||
249 | public function geoadd($key, $lng, $lat, $member, ...$other_triples) | ||
250 | { | ||
251 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geoadd(...\func_get_args()); | ||
252 | } | ||
253 | |||
254 | public function geodist($key, $src, $dst, $unit = null) | ||
255 | { | ||
256 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geodist(...\func_get_args()); | ||
257 | } | ||
258 | |||
259 | public function geohash($key, $member, ...$other_members) | ||
260 | { | ||
261 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geohash(...\func_get_args()); | ||
262 | } | ||
263 | |||
264 | public function geopos($key, $member, ...$other_members) | ||
265 | { | ||
266 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geopos(...\func_get_args()); | ||
267 | } | ||
268 | |||
269 | public function georadius($key, $lng, $lan, $radius, $unit, $opts = null) | ||
270 | { | ||
271 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadius(...\func_get_args()); | ||
272 | } | ||
273 | |||
274 | public function georadius_ro($key, $lng, $lan, $radius, $unit, $opts = null) | ||
275 | { | ||
276 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadius_ro(...\func_get_args()); | ||
277 | } | ||
278 | |||
279 | public function georadiusbymember($key, $member, $radius, $unit, $opts = null) | ||
280 | { | ||
281 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadiusbymember(...\func_get_args()); | ||
282 | } | ||
283 | |||
284 | public function georadiusbymember_ro($key, $member, $radius, $unit, $opts = null) | ||
285 | { | ||
286 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadiusbymember_ro(...\func_get_args()); | ||
287 | } | ||
288 | |||
289 | public function get($key) | ||
290 | { | ||
291 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->get(...\func_get_args()); | ||
292 | } | ||
293 | |||
294 | public function getbit($key, $offset) | ||
295 | { | ||
296 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getbit(...\func_get_args()); | ||
297 | } | ||
298 | |||
299 | public function getlasterror() | ||
300 | { | ||
301 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getlasterror(...\func_get_args()); | ||
302 | } | ||
303 | |||
304 | public function getmode() | ||
305 | { | ||
306 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getmode(...\func_get_args()); | ||
307 | } | ||
308 | |||
309 | public function getoption($option) | ||
310 | { | ||
311 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getoption(...\func_get_args()); | ||
312 | } | ||
313 | |||
314 | public function getrange($key, $start, $end) | ||
315 | { | ||
316 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getrange(...\func_get_args()); | ||
317 | } | ||
318 | |||
319 | public function getset($key, $value) | ||
320 | { | ||
321 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getset(...\func_get_args()); | ||
322 | } | ||
323 | |||
324 | public function hdel($key, $member, ...$other_members) | ||
325 | { | ||
326 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hdel(...\func_get_args()); | ||
327 | } | ||
328 | |||
329 | public function hexists($key, $member) | ||
330 | { | ||
331 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hexists(...\func_get_args()); | ||
332 | } | ||
333 | |||
334 | public function hget($key, $member) | ||
335 | { | ||
336 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hget(...\func_get_args()); | ||
337 | } | ||
338 | |||
339 | public function hgetall($key) | ||
340 | { | ||
341 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hgetall(...\func_get_args()); | ||
342 | } | ||
343 | |||
344 | public function hincrby($key, $member, $value) | ||
345 | { | ||
346 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hincrby(...\func_get_args()); | ||
347 | } | ||
348 | |||
349 | public function hincrbyfloat($key, $member, $value) | ||
350 | { | ||
351 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hincrbyfloat(...\func_get_args()); | ||
352 | } | ||
353 | |||
354 | public function hkeys($key) | ||
355 | { | ||
356 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hkeys(...\func_get_args()); | ||
357 | } | ||
358 | |||
359 | public function hlen($key) | ||
360 | { | ||
361 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hlen(...\func_get_args()); | ||
362 | } | ||
363 | |||
364 | public function hmget($key, $keys) | ||
365 | { | ||
366 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hmget(...\func_get_args()); | ||
367 | } | ||
368 | |||
369 | public function hmset($key, $pairs) | ||
370 | { | ||
371 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hmset(...\func_get_args()); | ||
372 | } | ||
373 | |||
374 | public function hscan($str_key, &$i_iterator, $str_pattern = null, $i_count = null) | ||
375 | { | ||
376 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hscan($str_key, $i_iterator, ...\array_slice(\func_get_args(), 2)); | ||
377 | } | ||
378 | |||
379 | public function hset($key, $member, $value) | ||
380 | { | ||
381 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hset(...\func_get_args()); | ||
382 | } | ||
383 | |||
384 | public function hsetnx($key, $member, $value) | ||
385 | { | ||
386 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hsetnx(...\func_get_args()); | ||
387 | } | ||
388 | |||
389 | public function hstrlen($key, $member) | ||
390 | { | ||
391 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hstrlen(...\func_get_args()); | ||
392 | } | ||
393 | |||
394 | public function hvals($key) | ||
395 | { | ||
396 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hvals(...\func_get_args()); | ||
397 | } | ||
398 | |||
399 | public function incr($key) | ||
400 | { | ||
401 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incr(...\func_get_args()); | ||
402 | } | ||
403 | |||
404 | public function incrby($key, $value) | ||
405 | { | ||
406 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incrby(...\func_get_args()); | ||
407 | } | ||
408 | |||
409 | public function incrbyfloat($key, $value) | ||
410 | { | ||
411 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incrbyfloat(...\func_get_args()); | ||
412 | } | ||
413 | |||
414 | public function info($key_or_address, $option = null) | ||
415 | { | ||
416 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->info(...\func_get_args()); | ||
417 | } | ||
418 | |||
419 | public function keys($pattern) | ||
420 | { | ||
421 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->keys(...\func_get_args()); | ||
422 | } | ||
423 | |||
424 | public function lastsave($key_or_address) | ||
425 | { | ||
426 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lastsave(...\func_get_args()); | ||
427 | } | ||
428 | |||
429 | public function lget($key, $index) | ||
430 | { | ||
431 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lget(...\func_get_args()); | ||
432 | } | ||
433 | |||
434 | public function lindex($key, $index) | ||
435 | { | ||
436 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lindex(...\func_get_args()); | ||
437 | } | ||
438 | |||
439 | public function linsert($key, $position, $pivot, $value) | ||
440 | { | ||
441 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->linsert(...\func_get_args()); | ||
442 | } | ||
443 | |||
444 | public function llen($key) | ||
445 | { | ||
446 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->llen(...\func_get_args()); | ||
447 | } | ||
448 | |||
449 | public function lpop($key) | ||
450 | { | ||
451 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lpop(...\func_get_args()); | ||
452 | } | ||
453 | |||
454 | public function lpush($key, $value) | ||
455 | { | ||
456 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lpush(...\func_get_args()); | ||
457 | } | ||
458 | |||
459 | public function lpushx($key, $value) | ||
460 | { | ||
461 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lpushx(...\func_get_args()); | ||
462 | } | ||
463 | |||
464 | public function lrange($key, $start, $end) | ||
465 | { | ||
466 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lrange(...\func_get_args()); | ||
467 | } | ||
468 | |||
469 | public function lrem($key, $value) | ||
470 | { | ||
471 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lrem(...\func_get_args()); | ||
472 | } | ||
473 | |||
474 | public function lset($key, $index, $value) | ||
475 | { | ||
476 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lset(...\func_get_args()); | ||
477 | } | ||
478 | |||
479 | public function ltrim($key, $start, $stop) | ||
480 | { | ||
481 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ltrim(...\func_get_args()); | ||
482 | } | ||
483 | |||
484 | public function mget($keys) | ||
485 | { | ||
486 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mget(...\func_get_args()); | ||
487 | } | ||
488 | |||
489 | public function mset($pairs) | ||
490 | { | ||
491 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mset(...\func_get_args()); | ||
492 | } | ||
493 | |||
494 | public function msetnx($pairs) | ||
495 | { | ||
496 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->msetnx(...\func_get_args()); | ||
497 | } | ||
498 | |||
499 | public function multi() | ||
500 | { | ||
501 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->multi(...\func_get_args()); | ||
502 | } | ||
503 | |||
504 | public function object($field, $key) | ||
505 | { | ||
506 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->object(...\func_get_args()); | ||
507 | } | ||
508 | |||
509 | public function persist($key) | ||
510 | { | ||
511 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->persist(...\func_get_args()); | ||
512 | } | ||
513 | |||
514 | public function pexpire($key, $timestamp) | ||
515 | { | ||
516 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpire(...\func_get_args()); | ||
517 | } | ||
518 | |||
519 | public function pexpireat($key, $timestamp) | ||
520 | { | ||
521 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpireat(...\func_get_args()); | ||
522 | } | ||
523 | |||
524 | public function pfadd($key, $elements) | ||
525 | { | ||
526 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfadd(...\func_get_args()); | ||
527 | } | ||
528 | |||
529 | public function pfcount($key) | ||
530 | { | ||
531 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfcount(...\func_get_args()); | ||
532 | } | ||
533 | |||
534 | public function pfmerge($dstkey, $keys) | ||
535 | { | ||
536 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfmerge(...\func_get_args()); | ||
537 | } | ||
538 | |||
539 | public function ping($key_or_address) | ||
540 | { | ||
541 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ping(...\func_get_args()); | ||
542 | } | ||
543 | |||
544 | public function psetex($key, $expire, $value) | ||
545 | { | ||
546 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->psetex(...\func_get_args()); | ||
547 | } | ||
548 | |||
549 | public function psubscribe($patterns, $callback) | ||
550 | { | ||
551 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->psubscribe(...\func_get_args()); | ||
552 | } | ||
553 | |||
554 | public function pttl($key) | ||
555 | { | ||
556 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pttl(...\func_get_args()); | ||
557 | } | ||
558 | |||
559 | public function publish($channel, $message) | ||
560 | { | ||
561 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->publish(...\func_get_args()); | ||
562 | } | ||
563 | |||
564 | public function pubsub($key_or_address, $arg = null, ...$other_args) | ||
565 | { | ||
566 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pubsub(...\func_get_args()); | ||
567 | } | ||
568 | |||
569 | public function punsubscribe($pattern, ...$other_patterns) | ||
570 | { | ||
571 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->punsubscribe(...\func_get_args()); | ||
572 | } | ||
573 | |||
574 | public function randomkey($key_or_address) | ||
575 | { | ||
576 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->randomkey(...\func_get_args()); | ||
577 | } | ||
578 | |||
579 | public function rawcommand($cmd, ...$args) | ||
580 | { | ||
581 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rawcommand(...\func_get_args()); | ||
582 | } | ||
583 | |||
584 | public function rename($key, $newkey) | ||
585 | { | ||
586 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rename(...\func_get_args()); | ||
587 | } | ||
588 | |||
589 | public function renamenx($key, $newkey) | ||
590 | { | ||
591 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->renamenx(...\func_get_args()); | ||
592 | } | ||
593 | |||
594 | public function restore($ttl, $key, $value) | ||
595 | { | ||
596 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->restore(...\func_get_args()); | ||
597 | } | ||
598 | |||
599 | public function role() | ||
600 | { | ||
601 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->role(...\func_get_args()); | ||
602 | } | ||
603 | |||
604 | public function rpop($key) | ||
605 | { | ||
606 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpop(...\func_get_args()); | ||
607 | } | ||
608 | |||
609 | public function rpoplpush($src, $dst) | ||
610 | { | ||
611 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpoplpush(...\func_get_args()); | ||
612 | } | ||
613 | |||
614 | public function rpush($key, $value) | ||
615 | { | ||
616 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpush(...\func_get_args()); | ||
617 | } | ||
618 | |||
619 | public function rpushx($key, $value) | ||
620 | { | ||
621 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpushx(...\func_get_args()); | ||
622 | } | ||
623 | |||
624 | public function sadd($key, $value) | ||
625 | { | ||
626 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sadd(...\func_get_args()); | ||
627 | } | ||
628 | |||
629 | public function saddarray($key, $options) | ||
630 | { | ||
631 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->saddarray(...\func_get_args()); | ||
632 | } | ||
633 | |||
634 | public function save($key_or_address) | ||
635 | { | ||
636 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->save(...\func_get_args()); | ||
637 | } | ||
638 | |||
639 | public function scan(&$i_iterator, $str_node, $str_pattern = null, $i_count = null) | ||
640 | { | ||
641 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->scan($i_iterator, ...\array_slice(\func_get_args(), 1)); | ||
642 | } | ||
643 | |||
644 | public function scard($key) | ||
645 | { | ||
646 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->scard(...\func_get_args()); | ||
647 | } | ||
648 | |||
649 | public function script($key_or_address, $arg = null, ...$other_args) | ||
650 | { | ||
651 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->script(...\func_get_args()); | ||
652 | } | ||
653 | |||
654 | public function sdiff($key, ...$other_keys) | ||
655 | { | ||
656 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sdiff(...\func_get_args()); | ||
657 | } | ||
658 | |||
659 | public function sdiffstore($dst, $key, ...$other_keys) | ||
660 | { | ||
661 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sdiffstore(...\func_get_args()); | ||
662 | } | ||
663 | |||
664 | public function set($key, $value, $opts = null) | ||
665 | { | ||
666 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->set(...\func_get_args()); | ||
667 | } | ||
668 | |||
669 | public function setbit($key, $offset, $value) | ||
670 | { | ||
671 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setbit(...\func_get_args()); | ||
672 | } | ||
673 | |||
674 | public function setex($key, $expire, $value) | ||
675 | { | ||
676 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setex(...\func_get_args()); | ||
677 | } | ||
678 | |||
679 | public function setnx($key, $value) | ||
680 | { | ||
681 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setnx(...\func_get_args()); | ||
682 | } | ||
683 | |||
684 | public function setoption($option, $value) | ||
685 | { | ||
686 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setoption(...\func_get_args()); | ||
687 | } | ||
688 | |||
689 | public function setrange($key, $offset, $value) | ||
690 | { | ||
691 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setrange(...\func_get_args()); | ||
692 | } | ||
693 | |||
694 | public function sinter($key, ...$other_keys) | ||
695 | { | ||
696 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sinter(...\func_get_args()); | ||
697 | } | ||
698 | |||
699 | public function sinterstore($dst, $key, ...$other_keys) | ||
700 | { | ||
701 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sinterstore(...\func_get_args()); | ||
702 | } | ||
703 | |||
704 | public function sismember($key, $value) | ||
705 | { | ||
706 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sismember(...\func_get_args()); | ||
707 | } | ||
708 | |||
709 | public function slowlog($key_or_address, $arg = null, ...$other_args) | ||
710 | { | ||
711 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->slowlog(...\func_get_args()); | ||
712 | } | ||
713 | |||
714 | public function smembers($key) | ||
715 | { | ||
716 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->smembers(...\func_get_args()); | ||
717 | } | ||
718 | |||
719 | public function smove($src, $dst, $value) | ||
720 | { | ||
721 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->smove(...\func_get_args()); | ||
722 | } | ||
723 | |||
724 | public function sort($key, $options = null) | ||
725 | { | ||
726 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sort(...\func_get_args()); | ||
727 | } | ||
728 | |||
729 | public function spop($key) | ||
730 | { | ||
731 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->spop(...\func_get_args()); | ||
732 | } | ||
733 | |||
734 | public function srandmember($key, $count = null) | ||
735 | { | ||
736 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->srandmember(...\func_get_args()); | ||
737 | } | ||
738 | |||
739 | public function srem($key, $value) | ||
740 | { | ||
741 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->srem(...\func_get_args()); | ||
742 | } | ||
743 | |||
744 | public function sscan($str_key, &$i_iterator, $str_pattern = null, $i_count = null) | ||
745 | { | ||
746 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sscan($str_key, $i_iterator, ...\array_slice(\func_get_args(), 2)); | ||
747 | } | ||
748 | |||
749 | public function strlen($key) | ||
750 | { | ||
751 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->strlen(...\func_get_args()); | ||
752 | } | ||
753 | |||
754 | public function subscribe($channels, $callback) | ||
755 | { | ||
756 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->subscribe(...\func_get_args()); | ||
757 | } | ||
758 | |||
759 | public function sunion($key, ...$other_keys) | ||
760 | { | ||
761 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sunion(...\func_get_args()); | ||
762 | } | ||
763 | |||
764 | public function sunionstore($dst, $key, ...$other_keys) | ||
765 | { | ||
766 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sunionstore(...\func_get_args()); | ||
767 | } | ||
768 | |||
769 | public function time() | ||
770 | { | ||
771 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->time(...\func_get_args()); | ||
772 | } | ||
773 | |||
774 | public function ttl($key) | ||
775 | { | ||
776 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ttl(...\func_get_args()); | ||
777 | } | ||
778 | |||
779 | public function type($key) | ||
780 | { | ||
781 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->type(...\func_get_args()); | ||
782 | } | ||
783 | |||
784 | public function unsubscribe($channel, ...$other_channels) | ||
785 | { | ||
786 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unsubscribe(...\func_get_args()); | ||
787 | } | ||
788 | |||
789 | public function unlink($key, ...$other_keys) | ||
790 | { | ||
791 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unlink(...\func_get_args()); | ||
792 | } | ||
793 | |||
794 | public function unwatch() | ||
795 | { | ||
796 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unwatch(...\func_get_args()); | ||
797 | } | ||
798 | |||
799 | public function watch($key, ...$other_keys) | ||
800 | { | ||
801 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->watch(...\func_get_args()); | ||
802 | } | ||
803 | |||
804 | public function xack($str_key, $str_group, $arr_ids) | ||
805 | { | ||
806 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xack(...\func_get_args()); | ||
807 | } | ||
808 | |||
809 | public function xadd($str_key, $str_id, $arr_fields, $i_maxlen = null, $boo_approximate = null) | ||
810 | { | ||
811 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xadd(...\func_get_args()); | ||
812 | } | ||
813 | |||
814 | public function xclaim($str_key, $str_group, $str_consumer, $i_min_idle, $arr_ids, $arr_opts = null) | ||
815 | { | ||
816 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xclaim(...\func_get_args()); | ||
817 | } | ||
818 | |||
819 | public function xdel($str_key, $arr_ids) | ||
820 | { | ||
821 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xdel(...\func_get_args()); | ||
822 | } | ||
823 | |||
824 | public function xgroup($str_operation, $str_key = null, $str_arg1 = null, $str_arg2 = null, $str_arg3 = null) | ||
825 | { | ||
826 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xgroup(...\func_get_args()); | ||
827 | } | ||
828 | |||
829 | public function xinfo($str_cmd, $str_key = null, $str_group = null) | ||
830 | { | ||
831 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xinfo(...\func_get_args()); | ||
832 | } | ||
833 | |||
834 | public function xlen($key) | ||
835 | { | ||
836 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xlen(...\func_get_args()); | ||
837 | } | ||
838 | |||
839 | public function xpending($str_key, $str_group, $str_start = null, $str_end = null, $i_count = null, $str_consumer = null) | ||
840 | { | ||
841 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xpending(...\func_get_args()); | ||
842 | } | ||
843 | |||
844 | public function xrange($str_key, $str_start, $str_end, $i_count = null) | ||
845 | { | ||
846 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xrange(...\func_get_args()); | ||
847 | } | ||
848 | |||
849 | public function xread($arr_streams, $i_count = null, $i_block = null) | ||
850 | { | ||
851 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xread(...\func_get_args()); | ||
852 | } | ||
853 | |||
854 | public function xreadgroup($str_group, $str_consumer, $arr_streams, $i_count = null, $i_block = null) | ||
855 | { | ||
856 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xreadgroup(...\func_get_args()); | ||
857 | } | ||
858 | |||
859 | public function xrevrange($str_key, $str_start, $str_end, $i_count = null) | ||
860 | { | ||
861 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xrevrange(...\func_get_args()); | ||
862 | } | ||
863 | |||
864 | public function xtrim($str_key, $i_maxlen, $boo_approximate = null) | ||
865 | { | ||
866 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xtrim(...\func_get_args()); | ||
867 | } | ||
868 | |||
869 | public function zadd($key, $score, $value, ...$extra_args) | ||
870 | { | ||
871 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zadd(...\func_get_args()); | ||
872 | } | ||
873 | |||
874 | public function zcard($key) | ||
875 | { | ||
876 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zcard(...\func_get_args()); | ||
877 | } | ||
878 | |||
879 | public function zcount($key, $min, $max) | ||
880 | { | ||
881 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zcount(...\func_get_args()); | ||
882 | } | ||
883 | |||
884 | public function zincrby($key, $value, $member) | ||
885 | { | ||
886 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zincrby(...\func_get_args()); | ||
887 | } | ||
888 | |||
889 | public function zinterstore($key, $keys, $weights = null, $aggregate = null) | ||
890 | { | ||
891 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zinterstore(...\func_get_args()); | ||
892 | } | ||
893 | |||
894 | public function zlexcount($key, $min, $max) | ||
895 | { | ||
896 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zlexcount(...\func_get_args()); | ||
897 | } | ||
898 | |||
899 | public function zpopmax($key) | ||
900 | { | ||
901 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zpopmax(...\func_get_args()); | ||
902 | } | ||
903 | |||
904 | public function zpopmin($key) | ||
905 | { | ||
906 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zpopmin(...\func_get_args()); | ||
907 | } | ||
908 | |||
909 | public function zrange($key, $start, $end, $scores = null) | ||
910 | { | ||
911 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrange(...\func_get_args()); | ||
912 | } | ||
913 | |||
914 | public function zrangebylex($key, $min, $max, $offset = null, $limit = null) | ||
915 | { | ||
916 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrangebylex(...\func_get_args()); | ||
917 | } | ||
918 | |||
919 | public function zrangebyscore($key, $start, $end, $options = null) | ||
920 | { | ||
921 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrangebyscore(...\func_get_args()); | ||
922 | } | ||
923 | |||
924 | public function zrank($key, $member) | ||
925 | { | ||
926 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrank(...\func_get_args()); | ||
927 | } | ||
928 | |||
929 | public function zrem($key, $member, ...$other_members) | ||
930 | { | ||
931 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrem(...\func_get_args()); | ||
932 | } | ||
933 | |||
934 | public function zremrangebylex($key, $min, $max) | ||
935 | { | ||
936 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zremrangebylex(...\func_get_args()); | ||
937 | } | ||
938 | |||
939 | public function zremrangebyrank($key, $min, $max) | ||
940 | { | ||
941 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zremrangebyrank(...\func_get_args()); | ||
942 | } | ||
943 | |||
944 | public function zremrangebyscore($key, $min, $max) | ||
945 | { | ||
946 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zremrangebyscore(...\func_get_args()); | ||
947 | } | ||
948 | |||
949 | public function zrevrange($key, $start, $end, $scores = null) | ||
950 | { | ||
951 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrange(...\func_get_args()); | ||
952 | } | ||
953 | |||
954 | public function zrevrangebylex($key, $min, $max, $offset = null, $limit = null) | ||
955 | { | ||
956 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrangebylex(...\func_get_args()); | ||
957 | } | ||
958 | |||
959 | public function zrevrangebyscore($key, $start, $end, $options = null) | ||
960 | { | ||
961 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrangebyscore(...\func_get_args()); | ||
962 | } | ||
963 | |||
964 | public function zrevrank($key, $member) | ||
965 | { | ||
966 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrank(...\func_get_args()); | ||
967 | } | ||
968 | |||
969 | public function zscan($str_key, &$i_iterator, $str_pattern = null, $i_count = null) | ||
970 | { | ||
971 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscan($str_key, $i_iterator, ...\array_slice(\func_get_args(), 2)); | ||
972 | } | ||
973 | |||
974 | public function zscore($key, $member) | ||
975 | { | ||
976 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscore(...\func_get_args()); | ||
977 | } | ||
978 | |||
979 | public function zunionstore($key, $keys, $weights = null, $aggregate = null) | ||
980 | { | ||
981 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zunionstore(...\func_get_args()); | ||
982 | } | ||
983 | } | ||
diff --git a/vendor/symfony/cache/Traits/RedisCluster6Proxy.php b/vendor/symfony/cache/Traits/RedisCluster6Proxy.php new file mode 100644 index 0000000..fafc4ac --- /dev/null +++ b/vendor/symfony/cache/Traits/RedisCluster6Proxy.php | |||
@@ -0,0 +1,1143 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | use Symfony\Component\VarExporter\LazyObjectInterface; | ||
15 | use Symfony\Component\VarExporter\LazyProxyTrait; | ||
16 | use Symfony\Contracts\Service\ResetInterface; | ||
17 | |||
18 | // Help opcache.preload discover always-needed symbols | ||
19 | class_exists(\Symfony\Component\VarExporter\Internal\Hydrator::class); | ||
20 | class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectRegistry::class); | ||
21 | class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectState::class); | ||
22 | |||
23 | /** | ||
24 | * @internal | ||
25 | */ | ||
26 | class RedisCluster6Proxy extends \RedisCluster implements ResetInterface, LazyObjectInterface | ||
27 | { | ||
28 | use LazyProxyTrait { | ||
29 | resetLazyObject as reset; | ||
30 | } | ||
31 | |||
32 | private const LAZY_OBJECT_PROPERTY_SCOPES = []; | ||
33 | |||
34 | public function __construct($name, $seeds = null, $timeout = 0, $read_timeout = 0, $persistent = false, #[\SensitiveParameter] $auth = null, $context = null) | ||
35 | { | ||
36 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->__construct(...\func_get_args()); | ||
37 | } | ||
38 | |||
39 | public function _compress($value): string | ||
40 | { | ||
41 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_compress(...\func_get_args()); | ||
42 | } | ||
43 | |||
44 | public function _uncompress($value): string | ||
45 | { | ||
46 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_uncompress(...\func_get_args()); | ||
47 | } | ||
48 | |||
49 | public function _serialize($value): bool|string | ||
50 | { | ||
51 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_serialize(...\func_get_args()); | ||
52 | } | ||
53 | |||
54 | public function _unserialize($value): mixed | ||
55 | { | ||
56 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_unserialize(...\func_get_args()); | ||
57 | } | ||
58 | |||
59 | public function _pack($value): string | ||
60 | { | ||
61 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_pack(...\func_get_args()); | ||
62 | } | ||
63 | |||
64 | public function _unpack($value): mixed | ||
65 | { | ||
66 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_unpack(...\func_get_args()); | ||
67 | } | ||
68 | |||
69 | public function _prefix($key): bool|string | ||
70 | { | ||
71 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_prefix(...\func_get_args()); | ||
72 | } | ||
73 | |||
74 | public function _masters(): array | ||
75 | { | ||
76 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_masters(...\func_get_args()); | ||
77 | } | ||
78 | |||
79 | public function _redir(): ?string | ||
80 | { | ||
81 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_redir(...\func_get_args()); | ||
82 | } | ||
83 | |||
84 | public function acl($key_or_address, $subcmd, ...$args): mixed | ||
85 | { | ||
86 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->acl(...\func_get_args()); | ||
87 | } | ||
88 | |||
89 | public function append($key, $value): \RedisCluster|bool|int | ||
90 | { | ||
91 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->append(...\func_get_args()); | ||
92 | } | ||
93 | |||
94 | public function bgrewriteaof($key_or_address): \RedisCluster|bool | ||
95 | { | ||
96 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgrewriteaof(...\func_get_args()); | ||
97 | } | ||
98 | |||
99 | public function bgsave($key_or_address): \RedisCluster|bool | ||
100 | { | ||
101 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgsave(...\func_get_args()); | ||
102 | } | ||
103 | |||
104 | public function bitcount($key, $start = 0, $end = -1, $bybit = false): \RedisCluster|bool|int | ||
105 | { | ||
106 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitcount(...\func_get_args()); | ||
107 | } | ||
108 | |||
109 | public function bitop($operation, $deskey, $srckey, ...$otherkeys): \RedisCluster|bool|int | ||
110 | { | ||
111 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitop(...\func_get_args()); | ||
112 | } | ||
113 | |||
114 | public function bitpos($key, $bit, $start = 0, $end = -1, $bybit = false): \RedisCluster|false|int | ||
115 | { | ||
116 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitpos(...\func_get_args()); | ||
117 | } | ||
118 | |||
119 | public function blpop($key, $timeout_or_key, ...$extra_args): \RedisCluster|array|false|null | ||
120 | { | ||
121 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blpop(...\func_get_args()); | ||
122 | } | ||
123 | |||
124 | public function brpop($key, $timeout_or_key, ...$extra_args): \RedisCluster|array|false|null | ||
125 | { | ||
126 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->brpop(...\func_get_args()); | ||
127 | } | ||
128 | |||
129 | public function brpoplpush($srckey, $deskey, $timeout): mixed | ||
130 | { | ||
131 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->brpoplpush(...\func_get_args()); | ||
132 | } | ||
133 | |||
134 | public function lmove($src, $dst, $wherefrom, $whereto): \Redis|false|string | ||
135 | { | ||
136 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lmove(...\func_get_args()); | ||
137 | } | ||
138 | |||
139 | public function blmove($src, $dst, $wherefrom, $whereto, $timeout): \Redis|false|string | ||
140 | { | ||
141 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blmove(...\func_get_args()); | ||
142 | } | ||
143 | |||
144 | public function bzpopmax($key, $timeout_or_key, ...$extra_args): array | ||
145 | { | ||
146 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzpopmax(...\func_get_args()); | ||
147 | } | ||
148 | |||
149 | public function bzpopmin($key, $timeout_or_key, ...$extra_args): array | ||
150 | { | ||
151 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzpopmin(...\func_get_args()); | ||
152 | } | ||
153 | |||
154 | public function bzmpop($timeout, $keys, $from, $count = 1): \RedisCluster|array|false|null | ||
155 | { | ||
156 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzmpop(...\func_get_args()); | ||
157 | } | ||
158 | |||
159 | public function zmpop($keys, $from, $count = 1): \RedisCluster|array|false|null | ||
160 | { | ||
161 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zmpop(...\func_get_args()); | ||
162 | } | ||
163 | |||
164 | public function blmpop($timeout, $keys, $from, $count = 1): \RedisCluster|array|false|null | ||
165 | { | ||
166 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blmpop(...\func_get_args()); | ||
167 | } | ||
168 | |||
169 | public function lmpop($keys, $from, $count = 1): \RedisCluster|array|false|null | ||
170 | { | ||
171 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lmpop(...\func_get_args()); | ||
172 | } | ||
173 | |||
174 | public function clearlasterror(): bool | ||
175 | { | ||
176 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->clearlasterror(...\func_get_args()); | ||
177 | } | ||
178 | |||
179 | public function client($key_or_address, $subcommand, $arg = null): array|bool|string | ||
180 | { | ||
181 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->client(...\func_get_args()); | ||
182 | } | ||
183 | |||
184 | public function close(): bool | ||
185 | { | ||
186 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->close(...\func_get_args()); | ||
187 | } | ||
188 | |||
189 | public function cluster($key_or_address, $command, ...$extra_args): mixed | ||
190 | { | ||
191 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cluster(...\func_get_args()); | ||
192 | } | ||
193 | |||
194 | public function command(...$extra_args): mixed | ||
195 | { | ||
196 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->command(...\func_get_args()); | ||
197 | } | ||
198 | |||
199 | public function config($key_or_address, $subcommand, ...$extra_args): mixed | ||
200 | { | ||
201 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->config(...\func_get_args()); | ||
202 | } | ||
203 | |||
204 | public function dbsize($key_or_address): \RedisCluster|int | ||
205 | { | ||
206 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dbsize(...\func_get_args()); | ||
207 | } | ||
208 | |||
209 | public function copy($src, $dst, $options = null): \RedisCluster|bool | ||
210 | { | ||
211 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args()); | ||
212 | } | ||
213 | |||
214 | public function decr($key, $by = 1): \RedisCluster|false|int | ||
215 | { | ||
216 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->decr(...\func_get_args()); | ||
217 | } | ||
218 | |||
219 | public function decrby($key, $value): \RedisCluster|false|int | ||
220 | { | ||
221 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->decrby(...\func_get_args()); | ||
222 | } | ||
223 | |||
224 | public function decrbyfloat($key, $value): float | ||
225 | { | ||
226 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->decrbyfloat(...\func_get_args()); | ||
227 | } | ||
228 | |||
229 | public function del($key, ...$other_keys): \RedisCluster|false|int | ||
230 | { | ||
231 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->del(...\func_get_args()); | ||
232 | } | ||
233 | |||
234 | public function discard(): bool | ||
235 | { | ||
236 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->discard(...\func_get_args()); | ||
237 | } | ||
238 | |||
239 | public function dump($key): \RedisCluster|false|string | ||
240 | { | ||
241 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args()); | ||
242 | } | ||
243 | |||
244 | public function echo($key_or_address, $msg): \RedisCluster|false|string | ||
245 | { | ||
246 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->echo(...\func_get_args()); | ||
247 | } | ||
248 | |||
249 | public function eval($script, $args = [], $num_keys = 0): mixed | ||
250 | { | ||
251 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->eval(...\func_get_args()); | ||
252 | } | ||
253 | |||
254 | public function eval_ro($script, $args = [], $num_keys = 0): mixed | ||
255 | { | ||
256 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->eval_ro(...\func_get_args()); | ||
257 | } | ||
258 | |||
259 | public function evalsha($script_sha, $args = [], $num_keys = 0): mixed | ||
260 | { | ||
261 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->evalsha(...\func_get_args()); | ||
262 | } | ||
263 | |||
264 | public function evalsha_ro($script_sha, $args = [], $num_keys = 0): mixed | ||
265 | { | ||
266 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->evalsha_ro(...\func_get_args()); | ||
267 | } | ||
268 | |||
269 | public function exec(): array|false | ||
270 | { | ||
271 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->exec(...\func_get_args()); | ||
272 | } | ||
273 | |||
274 | public function exists($key, ...$other_keys): \RedisCluster|bool|int | ||
275 | { | ||
276 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->exists(...\func_get_args()); | ||
277 | } | ||
278 | |||
279 | public function touch($key, ...$other_keys): \RedisCluster|bool|int | ||
280 | { | ||
281 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->touch(...\func_get_args()); | ||
282 | } | ||
283 | |||
284 | public function expire($key, $timeout, $mode = null): \RedisCluster|bool | ||
285 | { | ||
286 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expire(...\func_get_args()); | ||
287 | } | ||
288 | |||
289 | public function expireat($key, $timestamp, $mode = null): \RedisCluster|bool | ||
290 | { | ||
291 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expireat(...\func_get_args()); | ||
292 | } | ||
293 | |||
294 | public function expiretime($key): \RedisCluster|false|int | ||
295 | { | ||
296 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expiretime(...\func_get_args()); | ||
297 | } | ||
298 | |||
299 | public function pexpiretime($key): \RedisCluster|false|int | ||
300 | { | ||
301 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpiretime(...\func_get_args()); | ||
302 | } | ||
303 | |||
304 | public function flushall($key_or_address, $async = false): \RedisCluster|bool | ||
305 | { | ||
306 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->flushall(...\func_get_args()); | ||
307 | } | ||
308 | |||
309 | public function flushdb($key_or_address, $async = false): \RedisCluster|bool | ||
310 | { | ||
311 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->flushdb(...\func_get_args()); | ||
312 | } | ||
313 | |||
314 | public function geoadd($key, $lng, $lat, $member, ...$other_triples_and_options): \RedisCluster|false|int | ||
315 | { | ||
316 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geoadd(...\func_get_args()); | ||
317 | } | ||
318 | |||
319 | public function geodist($key, $src, $dest, $unit = null): \RedisCluster|false|float | ||
320 | { | ||
321 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geodist(...\func_get_args()); | ||
322 | } | ||
323 | |||
324 | public function geohash($key, $member, ...$other_members): \RedisCluster|array|false | ||
325 | { | ||
326 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geohash(...\func_get_args()); | ||
327 | } | ||
328 | |||
329 | public function geopos($key, $member, ...$other_members): \RedisCluster|array|false | ||
330 | { | ||
331 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geopos(...\func_get_args()); | ||
332 | } | ||
333 | |||
334 | public function georadius($key, $lng, $lat, $radius, $unit, $options = []): mixed | ||
335 | { | ||
336 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadius(...\func_get_args()); | ||
337 | } | ||
338 | |||
339 | public function georadius_ro($key, $lng, $lat, $radius, $unit, $options = []): mixed | ||
340 | { | ||
341 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadius_ro(...\func_get_args()); | ||
342 | } | ||
343 | |||
344 | public function georadiusbymember($key, $member, $radius, $unit, $options = []): mixed | ||
345 | { | ||
346 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadiusbymember(...\func_get_args()); | ||
347 | } | ||
348 | |||
349 | public function georadiusbymember_ro($key, $member, $radius, $unit, $options = []): mixed | ||
350 | { | ||
351 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadiusbymember_ro(...\func_get_args()); | ||
352 | } | ||
353 | |||
354 | public function geosearch($key, $position, $shape, $unit, $options = []): \RedisCluster|array | ||
355 | { | ||
356 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geosearch(...\func_get_args()); | ||
357 | } | ||
358 | |||
359 | public function geosearchstore($dst, $src, $position, $shape, $unit, $options = []): \RedisCluster|array|false|int | ||
360 | { | ||
361 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geosearchstore(...\func_get_args()); | ||
362 | } | ||
363 | |||
364 | public function get($key): mixed | ||
365 | { | ||
366 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->get(...\func_get_args()); | ||
367 | } | ||
368 | |||
369 | public function getbit($key, $value): \RedisCluster|false|int | ||
370 | { | ||
371 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getbit(...\func_get_args()); | ||
372 | } | ||
373 | |||
374 | public function getlasterror(): ?string | ||
375 | { | ||
376 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getlasterror(...\func_get_args()); | ||
377 | } | ||
378 | |||
379 | public function getmode(): int | ||
380 | { | ||
381 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getmode(...\func_get_args()); | ||
382 | } | ||
383 | |||
384 | public function getoption($option): mixed | ||
385 | { | ||
386 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getoption(...\func_get_args()); | ||
387 | } | ||
388 | |||
389 | public function getrange($key, $start, $end): \RedisCluster|false|string | ||
390 | { | ||
391 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getrange(...\func_get_args()); | ||
392 | } | ||
393 | |||
394 | public function lcs($key1, $key2, $options = null): \RedisCluster|array|false|int|string | ||
395 | { | ||
396 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lcs(...\func_get_args()); | ||
397 | } | ||
398 | |||
399 | public function getset($key, $value): \RedisCluster|bool|string | ||
400 | { | ||
401 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getset(...\func_get_args()); | ||
402 | } | ||
403 | |||
404 | public function gettransferredbytes(): array|false | ||
405 | { | ||
406 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->gettransferredbytes(...\func_get_args()); | ||
407 | } | ||
408 | |||
409 | public function cleartransferredbytes(): void | ||
410 | { | ||
411 | ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cleartransferredbytes(...\func_get_args()); | ||
412 | } | ||
413 | |||
414 | public function hdel($key, $member, ...$other_members): \RedisCluster|false|int | ||
415 | { | ||
416 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hdel(...\func_get_args()); | ||
417 | } | ||
418 | |||
419 | public function hexists($key, $member): \RedisCluster|bool | ||
420 | { | ||
421 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hexists(...\func_get_args()); | ||
422 | } | ||
423 | |||
424 | public function hget($key, $member): mixed | ||
425 | { | ||
426 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hget(...\func_get_args()); | ||
427 | } | ||
428 | |||
429 | public function hgetall($key): \RedisCluster|array|false | ||
430 | { | ||
431 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hgetall(...\func_get_args()); | ||
432 | } | ||
433 | |||
434 | public function hincrby($key, $member, $value): \RedisCluster|false|int | ||
435 | { | ||
436 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hincrby(...\func_get_args()); | ||
437 | } | ||
438 | |||
439 | public function hincrbyfloat($key, $member, $value): \RedisCluster|false|float | ||
440 | { | ||
441 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hincrbyfloat(...\func_get_args()); | ||
442 | } | ||
443 | |||
444 | public function hkeys($key): \RedisCluster|array|false | ||
445 | { | ||
446 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hkeys(...\func_get_args()); | ||
447 | } | ||
448 | |||
449 | public function hlen($key): \RedisCluster|false|int | ||
450 | { | ||
451 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hlen(...\func_get_args()); | ||
452 | } | ||
453 | |||
454 | public function hmget($key, $keys): \RedisCluster|array|false | ||
455 | { | ||
456 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hmget(...\func_get_args()); | ||
457 | } | ||
458 | |||
459 | public function hmset($key, $key_values): \RedisCluster|bool | ||
460 | { | ||
461 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hmset(...\func_get_args()); | ||
462 | } | ||
463 | |||
464 | public function hscan($key, &$iterator, $pattern = null, $count = 0): array|bool | ||
465 | { | ||
466 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hscan($key, $iterator, ...\array_slice(\func_get_args(), 2)); | ||
467 | } | ||
468 | |||
469 | public function hrandfield($key, $options = null): \RedisCluster|array|string | ||
470 | { | ||
471 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hrandfield(...\func_get_args()); | ||
472 | } | ||
473 | |||
474 | public function hset($key, $member, $value): \RedisCluster|false|int | ||
475 | { | ||
476 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hset(...\func_get_args()); | ||
477 | } | ||
478 | |||
479 | public function hsetnx($key, $member, $value): \RedisCluster|bool | ||
480 | { | ||
481 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hsetnx(...\func_get_args()); | ||
482 | } | ||
483 | |||
484 | public function hstrlen($key, $field): \RedisCluster|false|int | ||
485 | { | ||
486 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hstrlen(...\func_get_args()); | ||
487 | } | ||
488 | |||
489 | public function hvals($key): \RedisCluster|array|false | ||
490 | { | ||
491 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hvals(...\func_get_args()); | ||
492 | } | ||
493 | |||
494 | public function incr($key, $by = 1): \RedisCluster|false|int | ||
495 | { | ||
496 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incr(...\func_get_args()); | ||
497 | } | ||
498 | |||
499 | public function incrby($key, $value): \RedisCluster|false|int | ||
500 | { | ||
501 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incrby(...\func_get_args()); | ||
502 | } | ||
503 | |||
504 | public function incrbyfloat($key, $value): \RedisCluster|false|float | ||
505 | { | ||
506 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incrbyfloat(...\func_get_args()); | ||
507 | } | ||
508 | |||
509 | public function info($key_or_address, ...$sections): \RedisCluster|array|false | ||
510 | { | ||
511 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->info(...\func_get_args()); | ||
512 | } | ||
513 | |||
514 | public function keys($pattern): \RedisCluster|array|false | ||
515 | { | ||
516 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->keys(...\func_get_args()); | ||
517 | } | ||
518 | |||
519 | public function lastsave($key_or_address): \RedisCluster|false|int | ||
520 | { | ||
521 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lastsave(...\func_get_args()); | ||
522 | } | ||
523 | |||
524 | public function lget($key, $index): \RedisCluster|bool|string | ||
525 | { | ||
526 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lget(...\func_get_args()); | ||
527 | } | ||
528 | |||
529 | public function lindex($key, $index): mixed | ||
530 | { | ||
531 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lindex(...\func_get_args()); | ||
532 | } | ||
533 | |||
534 | public function linsert($key, $pos, $pivot, $value): \RedisCluster|false|int | ||
535 | { | ||
536 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->linsert(...\func_get_args()); | ||
537 | } | ||
538 | |||
539 | public function llen($key): \RedisCluster|bool|int | ||
540 | { | ||
541 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->llen(...\func_get_args()); | ||
542 | } | ||
543 | |||
544 | public function lpop($key, $count = 0): \RedisCluster|array|bool|string | ||
545 | { | ||
546 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lpop(...\func_get_args()); | ||
547 | } | ||
548 | |||
549 | public function lpos($key, $value, $options = null): \Redis|array|bool|int|null | ||
550 | { | ||
551 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lpos(...\func_get_args()); | ||
552 | } | ||
553 | |||
554 | public function lpush($key, $value, ...$other_values): \RedisCluster|bool|int | ||
555 | { | ||
556 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lpush(...\func_get_args()); | ||
557 | } | ||
558 | |||
559 | public function lpushx($key, $value): \RedisCluster|bool|int | ||
560 | { | ||
561 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lpushx(...\func_get_args()); | ||
562 | } | ||
563 | |||
564 | public function lrange($key, $start, $end): \RedisCluster|array|false | ||
565 | { | ||
566 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lrange(...\func_get_args()); | ||
567 | } | ||
568 | |||
569 | public function lrem($key, $value, $count = 0): \RedisCluster|bool|int | ||
570 | { | ||
571 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lrem(...\func_get_args()); | ||
572 | } | ||
573 | |||
574 | public function lset($key, $index, $value): \RedisCluster|bool | ||
575 | { | ||
576 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lset(...\func_get_args()); | ||
577 | } | ||
578 | |||
579 | public function ltrim($key, $start, $end): \RedisCluster|bool | ||
580 | { | ||
581 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ltrim(...\func_get_args()); | ||
582 | } | ||
583 | |||
584 | public function mget($keys): \RedisCluster|array|false | ||
585 | { | ||
586 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mget(...\func_get_args()); | ||
587 | } | ||
588 | |||
589 | public function mset($key_values): \RedisCluster|bool | ||
590 | { | ||
591 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mset(...\func_get_args()); | ||
592 | } | ||
593 | |||
594 | public function msetnx($key_values): \RedisCluster|array|false | ||
595 | { | ||
596 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->msetnx(...\func_get_args()); | ||
597 | } | ||
598 | |||
599 | public function multi($value = \Redis::MULTI): \RedisCluster|bool | ||
600 | { | ||
601 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->multi(...\func_get_args()); | ||
602 | } | ||
603 | |||
604 | public function object($subcommand, $key): \RedisCluster|false|int|string | ||
605 | { | ||
606 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->object(...\func_get_args()); | ||
607 | } | ||
608 | |||
609 | public function persist($key): \RedisCluster|bool | ||
610 | { | ||
611 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->persist(...\func_get_args()); | ||
612 | } | ||
613 | |||
614 | public function pexpire($key, $timeout, $mode = null): \RedisCluster|bool | ||
615 | { | ||
616 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpire(...\func_get_args()); | ||
617 | } | ||
618 | |||
619 | public function pexpireat($key, $timestamp, $mode = null): \RedisCluster|bool | ||
620 | { | ||
621 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpireat(...\func_get_args()); | ||
622 | } | ||
623 | |||
624 | public function pfadd($key, $elements): \RedisCluster|bool | ||
625 | { | ||
626 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfadd(...\func_get_args()); | ||
627 | } | ||
628 | |||
629 | public function pfcount($key): \RedisCluster|false|int | ||
630 | { | ||
631 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfcount(...\func_get_args()); | ||
632 | } | ||
633 | |||
634 | public function pfmerge($key, $keys): \RedisCluster|bool | ||
635 | { | ||
636 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfmerge(...\func_get_args()); | ||
637 | } | ||
638 | |||
639 | public function ping($key_or_address, $message = null): mixed | ||
640 | { | ||
641 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ping(...\func_get_args()); | ||
642 | } | ||
643 | |||
644 | public function psetex($key, $timeout, $value): \RedisCluster|bool | ||
645 | { | ||
646 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->psetex(...\func_get_args()); | ||
647 | } | ||
648 | |||
649 | public function psubscribe($patterns, $callback): void | ||
650 | { | ||
651 | ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->psubscribe(...\func_get_args()); | ||
652 | } | ||
653 | |||
654 | public function pttl($key): \RedisCluster|false|int | ||
655 | { | ||
656 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pttl(...\func_get_args()); | ||
657 | } | ||
658 | |||
659 | public function publish($channel, $message): \RedisCluster|bool | ||
660 | { | ||
661 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->publish(...\func_get_args()); | ||
662 | } | ||
663 | |||
664 | public function pubsub($key_or_address, ...$values): mixed | ||
665 | { | ||
666 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pubsub(...\func_get_args()); | ||
667 | } | ||
668 | |||
669 | public function punsubscribe($pattern, ...$other_patterns): array|bool | ||
670 | { | ||
671 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->punsubscribe(...\func_get_args()); | ||
672 | } | ||
673 | |||
674 | public function randomkey($key_or_address): \RedisCluster|bool|string | ||
675 | { | ||
676 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->randomkey(...\func_get_args()); | ||
677 | } | ||
678 | |||
679 | public function rawcommand($key_or_address, $command, ...$args): mixed | ||
680 | { | ||
681 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rawcommand(...\func_get_args()); | ||
682 | } | ||
683 | |||
684 | public function rename($key_src, $key_dst): \RedisCluster|bool | ||
685 | { | ||
686 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rename(...\func_get_args()); | ||
687 | } | ||
688 | |||
689 | public function renamenx($key, $newkey): \RedisCluster|bool | ||
690 | { | ||
691 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->renamenx(...\func_get_args()); | ||
692 | } | ||
693 | |||
694 | public function restore($key, $timeout, $value, $options = null): \RedisCluster|bool | ||
695 | { | ||
696 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->restore(...\func_get_args()); | ||
697 | } | ||
698 | |||
699 | public function role($key_or_address): mixed | ||
700 | { | ||
701 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->role(...\func_get_args()); | ||
702 | } | ||
703 | |||
704 | public function rpop($key, $count = 0): \RedisCluster|array|bool|string | ||
705 | { | ||
706 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpop(...\func_get_args()); | ||
707 | } | ||
708 | |||
709 | public function rpoplpush($src, $dst): \RedisCluster|bool|string | ||
710 | { | ||
711 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpoplpush(...\func_get_args()); | ||
712 | } | ||
713 | |||
714 | public function rpush($key, ...$elements): \RedisCluster|false|int | ||
715 | { | ||
716 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpush(...\func_get_args()); | ||
717 | } | ||
718 | |||
719 | public function rpushx($key, $value): \RedisCluster|bool|int | ||
720 | { | ||
721 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpushx(...\func_get_args()); | ||
722 | } | ||
723 | |||
724 | public function sadd($key, $value, ...$other_values): \RedisCluster|false|int | ||
725 | { | ||
726 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sadd(...\func_get_args()); | ||
727 | } | ||
728 | |||
729 | public function saddarray($key, $values): \RedisCluster|bool|int | ||
730 | { | ||
731 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->saddarray(...\func_get_args()); | ||
732 | } | ||
733 | |||
734 | public function save($key_or_address): \RedisCluster|bool | ||
735 | { | ||
736 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->save(...\func_get_args()); | ||
737 | } | ||
738 | |||
739 | public function scan(&$iterator, $key_or_address, $pattern = null, $count = 0): array|bool | ||
740 | { | ||
741 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->scan($iterator, ...\array_slice(\func_get_args(), 1)); | ||
742 | } | ||
743 | |||
744 | public function scard($key): \RedisCluster|false|int | ||
745 | { | ||
746 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->scard(...\func_get_args()); | ||
747 | } | ||
748 | |||
749 | public function script($key_or_address, ...$args): mixed | ||
750 | { | ||
751 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->script(...\func_get_args()); | ||
752 | } | ||
753 | |||
754 | public function sdiff($key, ...$other_keys): \RedisCluster|array|false | ||
755 | { | ||
756 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sdiff(...\func_get_args()); | ||
757 | } | ||
758 | |||
759 | public function sdiffstore($dst, $key, ...$other_keys): \RedisCluster|false|int | ||
760 | { | ||
761 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sdiffstore(...\func_get_args()); | ||
762 | } | ||
763 | |||
764 | public function set($key, $value, $options = null): \RedisCluster|bool|string | ||
765 | { | ||
766 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->set(...\func_get_args()); | ||
767 | } | ||
768 | |||
769 | public function setbit($key, $offset, $onoff): \RedisCluster|false|int | ||
770 | { | ||
771 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setbit(...\func_get_args()); | ||
772 | } | ||
773 | |||
774 | public function setex($key, $expire, $value): \RedisCluster|bool | ||
775 | { | ||
776 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setex(...\func_get_args()); | ||
777 | } | ||
778 | |||
779 | public function setnx($key, $value): \RedisCluster|bool | ||
780 | { | ||
781 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setnx(...\func_get_args()); | ||
782 | } | ||
783 | |||
784 | public function setoption($option, $value): bool | ||
785 | { | ||
786 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setoption(...\func_get_args()); | ||
787 | } | ||
788 | |||
789 | public function setrange($key, $offset, $value): \RedisCluster|false|int | ||
790 | { | ||
791 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setrange(...\func_get_args()); | ||
792 | } | ||
793 | |||
794 | public function sinter($key, ...$other_keys): \RedisCluster|array|false | ||
795 | { | ||
796 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sinter(...\func_get_args()); | ||
797 | } | ||
798 | |||
799 | public function sintercard($keys, $limit = -1): \RedisCluster|false|int | ||
800 | { | ||
801 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sintercard(...\func_get_args()); | ||
802 | } | ||
803 | |||
804 | public function sinterstore($key, ...$other_keys): \RedisCluster|false|int | ||
805 | { | ||
806 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sinterstore(...\func_get_args()); | ||
807 | } | ||
808 | |||
809 | public function sismember($key, $value): \RedisCluster|bool | ||
810 | { | ||
811 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sismember(...\func_get_args()); | ||
812 | } | ||
813 | |||
814 | public function smismember($key, $member, ...$other_members): \RedisCluster|array|false | ||
815 | { | ||
816 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->smismember(...\func_get_args()); | ||
817 | } | ||
818 | |||
819 | public function slowlog($key_or_address, ...$args): mixed | ||
820 | { | ||
821 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->slowlog(...\func_get_args()); | ||
822 | } | ||
823 | |||
824 | public function smembers($key): \RedisCluster|array|false | ||
825 | { | ||
826 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->smembers(...\func_get_args()); | ||
827 | } | ||
828 | |||
829 | public function smove($src, $dst, $member): \RedisCluster|bool | ||
830 | { | ||
831 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->smove(...\func_get_args()); | ||
832 | } | ||
833 | |||
834 | public function sort($key, $options = null): \RedisCluster|array|bool|int|string | ||
835 | { | ||
836 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sort(...\func_get_args()); | ||
837 | } | ||
838 | |||
839 | public function sort_ro($key, $options = null): \RedisCluster|array|bool|int|string | ||
840 | { | ||
841 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sort_ro(...\func_get_args()); | ||
842 | } | ||
843 | |||
844 | public function spop($key, $count = 0): \RedisCluster|array|false|string | ||
845 | { | ||
846 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->spop(...\func_get_args()); | ||
847 | } | ||
848 | |||
849 | public function srandmember($key, $count = 0): \RedisCluster|array|false|string | ||
850 | { | ||
851 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->srandmember(...\func_get_args()); | ||
852 | } | ||
853 | |||
854 | public function srem($key, $value, ...$other_values): \RedisCluster|false|int | ||
855 | { | ||
856 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->srem(...\func_get_args()); | ||
857 | } | ||
858 | |||
859 | public function sscan($key, &$iterator, $pattern = null, $count = 0): array|false | ||
860 | { | ||
861 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sscan($key, $iterator, ...\array_slice(\func_get_args(), 2)); | ||
862 | } | ||
863 | |||
864 | public function strlen($key): \RedisCluster|false|int | ||
865 | { | ||
866 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->strlen(...\func_get_args()); | ||
867 | } | ||
868 | |||
869 | public function subscribe($channels, $cb): void | ||
870 | { | ||
871 | ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->subscribe(...\func_get_args()); | ||
872 | } | ||
873 | |||
874 | public function sunion($key, ...$other_keys): \RedisCluster|array|bool | ||
875 | { | ||
876 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sunion(...\func_get_args()); | ||
877 | } | ||
878 | |||
879 | public function sunionstore($dst, $key, ...$other_keys): \RedisCluster|false|int | ||
880 | { | ||
881 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sunionstore(...\func_get_args()); | ||
882 | } | ||
883 | |||
884 | public function time($key_or_address): \RedisCluster|array|bool | ||
885 | { | ||
886 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->time(...\func_get_args()); | ||
887 | } | ||
888 | |||
889 | public function ttl($key): \RedisCluster|false|int | ||
890 | { | ||
891 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ttl(...\func_get_args()); | ||
892 | } | ||
893 | |||
894 | public function type($key): \RedisCluster|false|int | ||
895 | { | ||
896 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->type(...\func_get_args()); | ||
897 | } | ||
898 | |||
899 | public function unsubscribe($channels): array|bool | ||
900 | { | ||
901 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unsubscribe(...\func_get_args()); | ||
902 | } | ||
903 | |||
904 | public function unlink($key, ...$other_keys): \RedisCluster|false|int | ||
905 | { | ||
906 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unlink(...\func_get_args()); | ||
907 | } | ||
908 | |||
909 | public function unwatch(): bool | ||
910 | { | ||
911 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unwatch(...\func_get_args()); | ||
912 | } | ||
913 | |||
914 | public function watch($key, ...$other_keys): \RedisCluster|bool | ||
915 | { | ||
916 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->watch(...\func_get_args()); | ||
917 | } | ||
918 | |||
919 | public function xack($key, $group, $ids): \RedisCluster|false|int | ||
920 | { | ||
921 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xack(...\func_get_args()); | ||
922 | } | ||
923 | |||
924 | public function xadd($key, $id, $values, $maxlen = 0, $approx = false): \RedisCluster|false|string | ||
925 | { | ||
926 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xadd(...\func_get_args()); | ||
927 | } | ||
928 | |||
929 | public function xclaim($key, $group, $consumer, $min_iddle, $ids, $options): \RedisCluster|array|false|string | ||
930 | { | ||
931 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xclaim(...\func_get_args()); | ||
932 | } | ||
933 | |||
934 | public function xdel($key, $ids): \RedisCluster|false|int | ||
935 | { | ||
936 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xdel(...\func_get_args()); | ||
937 | } | ||
938 | |||
939 | public function xgroup($operation, $key = null, $group = null, $id_or_consumer = null, $mkstream = false, $entries_read = -2): mixed | ||
940 | { | ||
941 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xgroup(...\func_get_args()); | ||
942 | } | ||
943 | |||
944 | public function xautoclaim($key, $group, $consumer, $min_idle, $start, $count = -1, $justid = false): \RedisCluster|array|bool | ||
945 | { | ||
946 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xautoclaim(...\func_get_args()); | ||
947 | } | ||
948 | |||
949 | public function xinfo($operation, $arg1 = null, $arg2 = null, $count = -1): mixed | ||
950 | { | ||
951 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xinfo(...\func_get_args()); | ||
952 | } | ||
953 | |||
954 | public function xlen($key): \RedisCluster|false|int | ||
955 | { | ||
956 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xlen(...\func_get_args()); | ||
957 | } | ||
958 | |||
959 | public function xpending($key, $group, $start = null, $end = null, $count = -1, $consumer = null): \RedisCluster|array|false | ||
960 | { | ||
961 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xpending(...\func_get_args()); | ||
962 | } | ||
963 | |||
964 | public function xrange($key, $start, $end, $count = -1): \RedisCluster|array|bool | ||
965 | { | ||
966 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xrange(...\func_get_args()); | ||
967 | } | ||
968 | |||
969 | public function xread($streams, $count = -1, $block = -1): \RedisCluster|array|bool | ||
970 | { | ||
971 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xread(...\func_get_args()); | ||
972 | } | ||
973 | |||
974 | public function xreadgroup($group, $consumer, $streams, $count = 1, $block = 1): \RedisCluster|array|bool | ||
975 | { | ||
976 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xreadgroup(...\func_get_args()); | ||
977 | } | ||
978 | |||
979 | public function xrevrange($key, $start, $end, $count = -1): \RedisCluster|array|bool | ||
980 | { | ||
981 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xrevrange(...\func_get_args()); | ||
982 | } | ||
983 | |||
984 | public function xtrim($key, $maxlen, $approx = false, $minid = false, $limit = -1): \RedisCluster|false|int | ||
985 | { | ||
986 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xtrim(...\func_get_args()); | ||
987 | } | ||
988 | |||
989 | public function zadd($key, $score_or_options, ...$more_scores_and_mems): \RedisCluster|false|float|int | ||
990 | { | ||
991 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zadd(...\func_get_args()); | ||
992 | } | ||
993 | |||
994 | public function zcard($key): \RedisCluster|false|int | ||
995 | { | ||
996 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zcard(...\func_get_args()); | ||
997 | } | ||
998 | |||
999 | public function zcount($key, $start, $end): \RedisCluster|false|int | ||
1000 | { | ||
1001 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zcount(...\func_get_args()); | ||
1002 | } | ||
1003 | |||
1004 | public function zincrby($key, $value, $member): \RedisCluster|false|float | ||
1005 | { | ||
1006 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zincrby(...\func_get_args()); | ||
1007 | } | ||
1008 | |||
1009 | public function zinterstore($dst, $keys, $weights = null, $aggregate = null): \RedisCluster|false|int | ||
1010 | { | ||
1011 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zinterstore(...\func_get_args()); | ||
1012 | } | ||
1013 | |||
1014 | public function zintercard($keys, $limit = -1): \RedisCluster|false|int | ||
1015 | { | ||
1016 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zintercard(...\func_get_args()); | ||
1017 | } | ||
1018 | |||
1019 | public function zlexcount($key, $min, $max): \RedisCluster|false|int | ||
1020 | { | ||
1021 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zlexcount(...\func_get_args()); | ||
1022 | } | ||
1023 | |||
1024 | public function zpopmax($key, $value = null): \RedisCluster|array|bool | ||
1025 | { | ||
1026 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zpopmax(...\func_get_args()); | ||
1027 | } | ||
1028 | |||
1029 | public function zpopmin($key, $value = null): \RedisCluster|array|bool | ||
1030 | { | ||
1031 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zpopmin(...\func_get_args()); | ||
1032 | } | ||
1033 | |||
1034 | public function zrange($key, $start, $end, $options = null): \RedisCluster|array|bool | ||
1035 | { | ||
1036 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrange(...\func_get_args()); | ||
1037 | } | ||
1038 | |||
1039 | public function zrangestore($dstkey, $srckey, $start, $end, $options = null): \RedisCluster|false|int | ||
1040 | { | ||
1041 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrangestore(...\func_get_args()); | ||
1042 | } | ||
1043 | |||
1044 | public function zrandmember($key, $options = null): \RedisCluster|array|string | ||
1045 | { | ||
1046 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrandmember(...\func_get_args()); | ||
1047 | } | ||
1048 | |||
1049 | public function zrangebylex($key, $min, $max, $offset = -1, $count = -1): \RedisCluster|array|false | ||
1050 | { | ||
1051 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrangebylex(...\func_get_args()); | ||
1052 | } | ||
1053 | |||
1054 | public function zrangebyscore($key, $start, $end, $options = []): \RedisCluster|array|false | ||
1055 | { | ||
1056 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrangebyscore(...\func_get_args()); | ||
1057 | } | ||
1058 | |||
1059 | public function zrank($key, $member): \RedisCluster|false|int | ||
1060 | { | ||
1061 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrank(...\func_get_args()); | ||
1062 | } | ||
1063 | |||
1064 | public function zrem($key, $value, ...$other_values): \RedisCluster|false|int | ||
1065 | { | ||
1066 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrem(...\func_get_args()); | ||
1067 | } | ||
1068 | |||
1069 | public function zremrangebylex($key, $min, $max): \RedisCluster|false|int | ||
1070 | { | ||
1071 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zremrangebylex(...\func_get_args()); | ||
1072 | } | ||
1073 | |||
1074 | public function zremrangebyrank($key, $min, $max): \RedisCluster|false|int | ||
1075 | { | ||
1076 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zremrangebyrank(...\func_get_args()); | ||
1077 | } | ||
1078 | |||
1079 | public function zremrangebyscore($key, $min, $max): \RedisCluster|false|int | ||
1080 | { | ||
1081 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zremrangebyscore(...\func_get_args()); | ||
1082 | } | ||
1083 | |||
1084 | public function zrevrange($key, $min, $max, $options = null): \RedisCluster|array|bool | ||
1085 | { | ||
1086 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrange(...\func_get_args()); | ||
1087 | } | ||
1088 | |||
1089 | public function zrevrangebylex($key, $min, $max, $options = null): \RedisCluster|array|bool | ||
1090 | { | ||
1091 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrangebylex(...\func_get_args()); | ||
1092 | } | ||
1093 | |||
1094 | public function zrevrangebyscore($key, $min, $max, $options = null): \RedisCluster|array|bool | ||
1095 | { | ||
1096 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrangebyscore(...\func_get_args()); | ||
1097 | } | ||
1098 | |||
1099 | public function zrevrank($key, $member): \RedisCluster|false|int | ||
1100 | { | ||
1101 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrank(...\func_get_args()); | ||
1102 | } | ||
1103 | |||
1104 | public function zscan($key, &$iterator, $pattern = null, $count = 0): \RedisCluster|array|bool | ||
1105 | { | ||
1106 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscan($key, $iterator, ...\array_slice(\func_get_args(), 2)); | ||
1107 | } | ||
1108 | |||
1109 | public function zscore($key, $member): \RedisCluster|false|float | ||
1110 | { | ||
1111 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscore(...\func_get_args()); | ||
1112 | } | ||
1113 | |||
1114 | public function zmscore($key, $member, ...$other_members): \Redis|array|false | ||
1115 | { | ||
1116 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zmscore(...\func_get_args()); | ||
1117 | } | ||
1118 | |||
1119 | public function zunionstore($dst, $keys, $weights = null, $aggregate = null): \RedisCluster|false|int | ||
1120 | { | ||
1121 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zunionstore(...\func_get_args()); | ||
1122 | } | ||
1123 | |||
1124 | public function zinter($keys, $weights = null, $options = null): \RedisCluster|array|false | ||
1125 | { | ||
1126 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zinter(...\func_get_args()); | ||
1127 | } | ||
1128 | |||
1129 | public function zdiffstore($dst, $keys): \RedisCluster|false|int | ||
1130 | { | ||
1131 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zdiffstore(...\func_get_args()); | ||
1132 | } | ||
1133 | |||
1134 | public function zunion($keys, $weights = null, $options = null): \RedisCluster|array|false | ||
1135 | { | ||
1136 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zunion(...\func_get_args()); | ||
1137 | } | ||
1138 | |||
1139 | public function zdiff($keys, $options = null): \RedisCluster|array|false | ||
1140 | { | ||
1141 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zdiff(...\func_get_args()); | ||
1142 | } | ||
1143 | } | ||
diff --git a/vendor/symfony/cache/Traits/RedisClusterNodeProxy.php b/vendor/symfony/cache/Traits/RedisClusterNodeProxy.php new file mode 100644 index 0000000..f5c0baa --- /dev/null +++ b/vendor/symfony/cache/Traits/RedisClusterNodeProxy.php | |||
@@ -0,0 +1,47 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | /** | ||
15 | * This file acts as a wrapper to the \RedisCluster implementation so it can accept the same type of calls as | ||
16 | * individual \Redis objects. | ||
17 | * | ||
18 | * Calls are made to individual nodes via: RedisCluster->{method}($host, ...args)' | ||
19 | * according to https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#directed-node-commands | ||
20 | * | ||
21 | * @author Jack Thomas <jack.thomas@solidalpha.com> | ||
22 | * | ||
23 | * @internal | ||
24 | */ | ||
25 | class RedisClusterNodeProxy | ||
26 | { | ||
27 | public function __construct( | ||
28 | private array $host, | ||
29 | private \RedisCluster $redis, | ||
30 | ) { | ||
31 | } | ||
32 | |||
33 | public function __call(string $method, array $args) | ||
34 | { | ||
35 | return $this->redis->{$method}($this->host, ...$args); | ||
36 | } | ||
37 | |||
38 | public function scan(&$iIterator, $strPattern = null, $iCount = null) | ||
39 | { | ||
40 | return $this->redis->scan($iIterator, $this->host, $strPattern, $iCount); | ||
41 | } | ||
42 | |||
43 | public function getOption($name) | ||
44 | { | ||
45 | return $this->redis->getOption($name); | ||
46 | } | ||
47 | } | ||
diff --git a/vendor/symfony/cache/Traits/RedisClusterProxy.php b/vendor/symfony/cache/Traits/RedisClusterProxy.php new file mode 100644 index 0000000..c67d534 --- /dev/null +++ b/vendor/symfony/cache/Traits/RedisClusterProxy.php | |||
@@ -0,0 +1,23 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | class_alias(6.0 <= (float) phpversion('redis') ? RedisCluster6Proxy::class : RedisCluster5Proxy::class, RedisClusterProxy::class); | ||
15 | |||
16 | if (false) { | ||
17 | /** | ||
18 | * @internal | ||
19 | */ | ||
20 | class RedisClusterProxy extends \RedisCluster | ||
21 | { | ||
22 | } | ||
23 | } | ||
diff --git a/vendor/symfony/cache/Traits/RedisProxy.php b/vendor/symfony/cache/Traits/RedisProxy.php new file mode 100644 index 0000000..7f4537b --- /dev/null +++ b/vendor/symfony/cache/Traits/RedisProxy.php | |||
@@ -0,0 +1,23 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | class_alias(6.0 <= (float) phpversion('redis') ? Redis6Proxy::class : Redis5Proxy::class, RedisProxy::class); | ||
15 | |||
16 | if (false) { | ||
17 | /** | ||
18 | * @internal | ||
19 | */ | ||
20 | class RedisProxy extends \Redis | ||
21 | { | ||
22 | } | ||
23 | } | ||
diff --git a/vendor/symfony/cache/Traits/RedisTrait.php b/vendor/symfony/cache/Traits/RedisTrait.php new file mode 100644 index 0000000..a4fdc5d --- /dev/null +++ b/vendor/symfony/cache/Traits/RedisTrait.php | |||
@@ -0,0 +1,682 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | use Predis\Command\Redis\UNLINK; | ||
15 | use Predis\Connection\Aggregate\ClusterInterface; | ||
16 | use Predis\Connection\Aggregate\RedisCluster; | ||
17 | use Predis\Connection\Aggregate\ReplicationInterface; | ||
18 | use Predis\Connection\Cluster\ClusterInterface as Predis2ClusterInterface; | ||
19 | use Predis\Connection\Cluster\RedisCluster as Predis2RedisCluster; | ||
20 | use Predis\Response\ErrorInterface; | ||
21 | use Predis\Response\Status; | ||
22 | use Relay\Relay; | ||
23 | use Relay\Sentinel; | ||
24 | use Symfony\Component\Cache\Exception\CacheException; | ||
25 | use Symfony\Component\Cache\Exception\InvalidArgumentException; | ||
26 | use Symfony\Component\Cache\Marshaller\DefaultMarshaller; | ||
27 | use Symfony\Component\Cache\Marshaller\MarshallerInterface; | ||
28 | |||
29 | /** | ||
30 | * @author Aurimas Niekis <aurimas@niekis.lt> | ||
31 | * @author Nicolas Grekas <p@tchwork.com> | ||
32 | * | ||
33 | * @internal | ||
34 | */ | ||
35 | trait RedisTrait | ||
36 | { | ||
37 | private static array $defaultConnectionOptions = [ | ||
38 | 'class' => null, | ||
39 | 'persistent' => 0, | ||
40 | 'persistent_id' => null, | ||
41 | 'timeout' => 30, | ||
42 | 'read_timeout' => 0, | ||
43 | 'retry_interval' => 0, | ||
44 | 'tcp_keepalive' => 0, | ||
45 | 'lazy' => null, | ||
46 | 'redis_cluster' => false, | ||
47 | 'redis_sentinel' => null, | ||
48 | 'dbindex' => 0, | ||
49 | 'failover' => 'none', | ||
50 | 'ssl' => null, // see https://php.net/context.ssl | ||
51 | ]; | ||
52 | private \Redis|Relay|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis; | ||
53 | private MarshallerInterface $marshaller; | ||
54 | |||
55 | private function init(\Redis|Relay|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis, string $namespace, int $defaultLifetime, ?MarshallerInterface $marshaller): void | ||
56 | { | ||
57 | parent::__construct($namespace, $defaultLifetime); | ||
58 | |||
59 | if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) { | ||
60 | throw new InvalidArgumentException(sprintf('RedisAdapter namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0])); | ||
61 | } | ||
62 | |||
63 | if ($redis instanceof \Predis\ClientInterface && $redis->getOptions()->exceptions) { | ||
64 | $options = clone $redis->getOptions(); | ||
65 | \Closure::bind(function () { $this->options['exceptions'] = false; }, $options, $options)(); | ||
66 | $redis = new $redis($redis->getConnection(), $options); | ||
67 | } | ||
68 | |||
69 | $this->redis = $redis; | ||
70 | $this->marshaller = $marshaller ?? new DefaultMarshaller(); | ||
71 | } | ||
72 | |||
73 | /** | ||
74 | * Creates a Redis connection using a DSN configuration. | ||
75 | * | ||
76 | * Example DSN: | ||
77 | * - redis://localhost | ||
78 | * - redis://example.com:1234 | ||
79 | * - redis://secret@example.com/13 | ||
80 | * - redis:///var/run/redis.sock | ||
81 | * - redis://secret@/var/run/redis.sock/13 | ||
82 | * | ||
83 | * @param array $options See self::$defaultConnectionOptions | ||
84 | * | ||
85 | * @throws InvalidArgumentException when the DSN is invalid | ||
86 | */ | ||
87 | public static function createConnection(#[\SensitiveParameter] string $dsn, array $options = []): \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface|Relay | ||
88 | { | ||
89 | if (str_starts_with($dsn, 'redis:')) { | ||
90 | $scheme = 'redis'; | ||
91 | } elseif (str_starts_with($dsn, 'rediss:')) { | ||
92 | $scheme = 'rediss'; | ||
93 | } else { | ||
94 | throw new InvalidArgumentException('Invalid Redis DSN: it does not start with "redis[s]:".'); | ||
95 | } | ||
96 | |||
97 | if (!\extension_loaded('redis') && !class_exists(\Predis\Client::class)) { | ||
98 | throw new CacheException('Cannot find the "redis" extension nor the "predis/predis" package.'); | ||
99 | } | ||
100 | |||
101 | $params = preg_replace_callback('#^'.$scheme.':(//)?(?:(?:(?<user>[^:@]*+):)?(?<password>[^@]*+)@)?#', function ($m) use (&$auth) { | ||
102 | if (isset($m['password'])) { | ||
103 | if (\in_array($m['user'], ['', 'default'], true)) { | ||
104 | $auth = rawurldecode($m['password']); | ||
105 | } else { | ||
106 | $auth = [rawurldecode($m['user']), rawurldecode($m['password'])]; | ||
107 | } | ||
108 | |||
109 | if ('' === $auth) { | ||
110 | $auth = null; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | return 'file:'.($m[1] ?? ''); | ||
115 | }, $dsn); | ||
116 | |||
117 | if (false === $params = parse_url($params)) { | ||
118 | throw new InvalidArgumentException('Invalid Redis DSN.'); | ||
119 | } | ||
120 | |||
121 | $query = $hosts = []; | ||
122 | |||
123 | $tls = 'rediss' === $scheme; | ||
124 | $tcpScheme = $tls ? 'tls' : 'tcp'; | ||
125 | |||
126 | if (isset($params['query'])) { | ||
127 | parse_str($params['query'], $query); | ||
128 | |||
129 | if (isset($query['host'])) { | ||
130 | if (!\is_array($hosts = $query['host'])) { | ||
131 | throw new InvalidArgumentException('Invalid Redis DSN: query parameter "host" must be an array.'); | ||
132 | } | ||
133 | foreach ($hosts as $host => $parameters) { | ||
134 | if (\is_string($parameters)) { | ||
135 | parse_str($parameters, $parameters); | ||
136 | } | ||
137 | if (false === $i = strrpos($host, ':')) { | ||
138 | $hosts[$host] = ['scheme' => $tcpScheme, 'host' => $host, 'port' => 6379] + $parameters; | ||
139 | } elseif ($port = (int) substr($host, 1 + $i)) { | ||
140 | $hosts[$host] = ['scheme' => $tcpScheme, 'host' => substr($host, 0, $i), 'port' => $port] + $parameters; | ||
141 | } else { | ||
142 | $hosts[$host] = ['scheme' => 'unix', 'path' => substr($host, 0, $i)] + $parameters; | ||
143 | } | ||
144 | } | ||
145 | $hosts = array_values($hosts); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | if (isset($params['host']) || isset($params['path'])) { | ||
150 | if (!isset($params['dbindex']) && isset($params['path'])) { | ||
151 | if (preg_match('#/(\d+)?$#', $params['path'], $m)) { | ||
152 | $params['dbindex'] = $m[1] ?? $query['dbindex'] ?? '0'; | ||
153 | $params['path'] = substr($params['path'], 0, -\strlen($m[0])); | ||
154 | } elseif (isset($params['host'])) { | ||
155 | throw new InvalidArgumentException('Invalid Redis DSN: parameter "dbindex" must be a number.'); | ||
156 | } | ||
157 | } | ||
158 | |||
159 | if (isset($params['host'])) { | ||
160 | array_unshift($hosts, ['scheme' => $tcpScheme, 'host' => $params['host'], 'port' => $params['port'] ?? 6379]); | ||
161 | } else { | ||
162 | array_unshift($hosts, ['scheme' => 'unix', 'path' => $params['path']]); | ||
163 | } | ||
164 | } | ||
165 | |||
166 | if (!$hosts) { | ||
167 | throw new InvalidArgumentException('Invalid Redis DSN: missing host.'); | ||
168 | } | ||
169 | |||
170 | if (isset($params['dbindex'], $query['dbindex']) && $params['dbindex'] !== $query['dbindex']) { | ||
171 | throw new InvalidArgumentException('Invalid Redis DSN: path and query "dbindex" parameters mismatch.'); | ||
172 | } | ||
173 | |||
174 | $params += $query + $options + self::$defaultConnectionOptions; | ||
175 | |||
176 | if (isset($params['redis_sentinel']) && isset($params['sentinel_master'])) { | ||
177 | throw new InvalidArgumentException('Cannot use both "redis_sentinel" and "sentinel_master" at the same time.'); | ||
178 | } | ||
179 | |||
180 | $params['redis_sentinel'] ??= $params['sentinel_master'] ?? null; | ||
181 | |||
182 | if (isset($params['redis_sentinel']) && !class_exists(\Predis\Client::class) && !class_exists(\RedisSentinel::class) && !class_exists(Sentinel::class)) { | ||
183 | throw new CacheException('Redis Sentinel support requires one of: "predis/predis", "ext-redis >= 5.2", "ext-relay".'); | ||
184 | } | ||
185 | |||
186 | if (isset($params['lazy'])) { | ||
187 | $params['lazy'] = filter_var($params['lazy'], \FILTER_VALIDATE_BOOLEAN); | ||
188 | } | ||
189 | $params['redis_cluster'] = filter_var($params['redis_cluster'], \FILTER_VALIDATE_BOOLEAN); | ||
190 | |||
191 | if ($params['redis_cluster'] && isset($params['redis_sentinel'])) { | ||
192 | throw new InvalidArgumentException('Cannot use both "redis_cluster" and "redis_sentinel" at the same time.'); | ||
193 | } | ||
194 | |||
195 | $class = $params['class'] ?? match (true) { | ||
196 | $params['redis_cluster'] => \extension_loaded('redis') ? \RedisCluster::class : \Predis\Client::class, | ||
197 | isset($params['redis_sentinel']) => match (true) { | ||
198 | \extension_loaded('redis') => \Redis::class, | ||
199 | \extension_loaded('relay') => Relay::class, | ||
200 | default => \Predis\Client::class, | ||
201 | }, | ||
202 | 1 < \count($hosts) && \extension_loaded('redis') => 1 < \count($hosts) ? \RedisArray::class : \Redis::class, | ||
203 | \extension_loaded('redis') => \Redis::class, | ||
204 | \extension_loaded('relay') => Relay::class, | ||
205 | default => \Predis\Client::class, | ||
206 | }; | ||
207 | |||
208 | if (isset($params['redis_sentinel']) && !is_a($class, \Predis\Client::class, true) && !class_exists(\RedisSentinel::class) && !class_exists(Sentinel::class)) { | ||
209 | throw new CacheException(sprintf('Cannot use Redis Sentinel: class "%s" does not extend "Predis\Client" and neither ext-redis >= 5.2 nor ext-relay have been found.', $class)); | ||
210 | } | ||
211 | |||
212 | $isRedisExt = is_a($class, \Redis::class, true); | ||
213 | $isRelayExt = !$isRedisExt && is_a($class, Relay::class, true); | ||
214 | |||
215 | if ($isRedisExt || $isRelayExt) { | ||
216 | $connect = $params['persistent'] || $params['persistent_id'] ? 'pconnect' : 'connect'; | ||
217 | |||
218 | $initializer = static function () use ($class, $isRedisExt, $connect, $params, $auth, $hosts, $tls) { | ||
219 | $sentinelClass = $isRedisExt ? \RedisSentinel::class : Sentinel::class; | ||
220 | $redis = new $class(); | ||
221 | $hostIndex = 0; | ||
222 | do { | ||
223 | $host = $hosts[$hostIndex]['host'] ?? $hosts[$hostIndex]['path']; | ||
224 | $port = $hosts[$hostIndex]['port'] ?? 0; | ||
225 | $passAuth = isset($params['auth']) && (!$isRedisExt || \defined('Redis::OPT_NULL_MULTIBULK_AS_NULL')); | ||
226 | $address = false; | ||
227 | |||
228 | if (isset($hosts[$hostIndex]['host']) && $tls) { | ||
229 | $host = 'tls://'.$host; | ||
230 | } | ||
231 | |||
232 | if (!isset($params['redis_sentinel'])) { | ||
233 | break; | ||
234 | } | ||
235 | |||
236 | try { | ||
237 | if (version_compare(phpversion('redis'), '6.0.0', '>=') && $isRedisExt) { | ||
238 | $options = [ | ||
239 | 'host' => $host, | ||
240 | 'port' => $port, | ||
241 | 'connectTimeout' => $params['timeout'], | ||
242 | 'persistent' => $params['persistent_id'], | ||
243 | 'retryInterval' => $params['retry_interval'], | ||
244 | 'readTimeout' => $params['read_timeout'], | ||
245 | ]; | ||
246 | |||
247 | if ($passAuth) { | ||
248 | $options['auth'] = $params['auth']; | ||
249 | } | ||
250 | |||
251 | $sentinel = new \RedisSentinel($options); | ||
252 | } else { | ||
253 | $extra = $passAuth ? [$params['auth']] : []; | ||
254 | |||
255 | $sentinel = new $sentinelClass($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...$extra); | ||
256 | } | ||
257 | |||
258 | if ($address = $sentinel->getMasterAddrByName($params['redis_sentinel'])) { | ||
259 | [$host, $port] = $address; | ||
260 | } | ||
261 | } catch (\RedisException|\Relay\Exception $redisException) { | ||
262 | } | ||
263 | } while (++$hostIndex < \count($hosts) && !$address); | ||
264 | |||
265 | if (isset($params['redis_sentinel']) && !$address) { | ||
266 | throw new InvalidArgumentException(sprintf('Failed to retrieve master information from sentinel "%s".', $params['redis_sentinel']), previous: $redisException ?? null); | ||
267 | } | ||
268 | |||
269 | try { | ||
270 | $extra = [ | ||
271 | 'stream' => $params['ssl'] ?? null, | ||
272 | ]; | ||
273 | $booleanStreamOptions = [ | ||
274 | 'allow_self_signed', | ||
275 | 'capture_peer_cert', | ||
276 | 'capture_peer_cert_chain', | ||
277 | 'disable_compression', | ||
278 | 'SNI_enabled', | ||
279 | 'verify_peer', | ||
280 | 'verify_peer_name', | ||
281 | ]; | ||
282 | |||
283 | foreach ($extra['stream'] ?? [] as $streamOption => $value) { | ||
284 | if (\in_array($streamOption, $booleanStreamOptions, true) && \is_string($value)) { | ||
285 | $extra['stream'][$streamOption] = filter_var($value, \FILTER_VALIDATE_BOOL); | ||
286 | } | ||
287 | } | ||
288 | |||
289 | if (isset($params['auth'])) { | ||
290 | $extra['auth'] = $params['auth']; | ||
291 | } | ||
292 | @$redis->{$connect}($host, $port, (float) $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...\defined('Redis::SCAN_PREFIX') || !$isRedisExt ? [$extra] : []); | ||
293 | |||
294 | set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); | ||
295 | try { | ||
296 | $isConnected = $redis->isConnected(); | ||
297 | } finally { | ||
298 | restore_error_handler(); | ||
299 | } | ||
300 | if (!$isConnected) { | ||
301 | $error = preg_match('/^Redis::p?connect\(\): (.*)/', $error ?? $redis->getLastError() ?? '', $error) ? sprintf(' (%s)', $error[1]) : ''; | ||
302 | throw new InvalidArgumentException('Redis connection failed: '.$error.'.'); | ||
303 | } | ||
304 | |||
305 | if ((null !== $auth && !$redis->auth($auth)) | ||
306 | // Due to a bug in phpredis we must always select the dbindex if persistent pooling is enabled | ||
307 | // @see https://github.com/phpredis/phpredis/issues/1920 | ||
308 | // @see https://github.com/symfony/symfony/issues/51578 | ||
309 | || (($params['dbindex'] || ('pconnect' === $connect && '0' !== \ini_get('redis.pconnect.pooling_enabled'))) && !$redis->select($params['dbindex'])) | ||
310 | ) { | ||
311 | $e = preg_replace('/^ERR /', '', $redis->getLastError()); | ||
312 | throw new InvalidArgumentException('Redis connection failed: '.$e.'.'); | ||
313 | } | ||
314 | |||
315 | if (0 < $params['tcp_keepalive'] && (!$isRedisExt || \defined('Redis::OPT_TCP_KEEPALIVE'))) { | ||
316 | $redis->setOption($isRedisExt ? \Redis::OPT_TCP_KEEPALIVE : Relay::OPT_TCP_KEEPALIVE, $params['tcp_keepalive']); | ||
317 | } | ||
318 | } catch (\RedisException|\Relay\Exception $e) { | ||
319 | throw new InvalidArgumentException('Redis connection failed: '.$e->getMessage()); | ||
320 | } | ||
321 | |||
322 | return $redis; | ||
323 | }; | ||
324 | |||
325 | if ($params['lazy']) { | ||
326 | $redis = $isRedisExt ? RedisProxy::createLazyProxy($initializer) : RelayProxy::createLazyProxy($initializer); | ||
327 | } else { | ||
328 | $redis = $initializer(); | ||
329 | } | ||
330 | } elseif (is_a($class, \RedisArray::class, true)) { | ||
331 | foreach ($hosts as $i => $host) { | ||
332 | $hosts[$i] = match ($host['scheme']) { | ||
333 | 'tcp' => $host['host'].':'.$host['port'], | ||
334 | 'tls' => 'tls://'.$host['host'].':'.$host['port'], | ||
335 | default => $host['path'], | ||
336 | }; | ||
337 | } | ||
338 | $params['lazy_connect'] = $params['lazy'] ?? true; | ||
339 | $params['connect_timeout'] = $params['timeout']; | ||
340 | |||
341 | try { | ||
342 | $redis = new $class($hosts, $params); | ||
343 | } catch (\RedisClusterException $e) { | ||
344 | throw new InvalidArgumentException('Redis connection failed: '.$e->getMessage()); | ||
345 | } | ||
346 | |||
347 | if (0 < $params['tcp_keepalive'] && (!$isRedisExt || \defined('Redis::OPT_TCP_KEEPALIVE'))) { | ||
348 | $redis->setOption($isRedisExt ? \Redis::OPT_TCP_KEEPALIVE : Relay::OPT_TCP_KEEPALIVE, $params['tcp_keepalive']); | ||
349 | } | ||
350 | } elseif (is_a($class, \RedisCluster::class, true)) { | ||
351 | $initializer = static function () use ($isRedisExt, $class, $params, $hosts) { | ||
352 | foreach ($hosts as $i => $host) { | ||
353 | $hosts[$i] = match ($host['scheme']) { | ||
354 | 'tcp' => $host['host'].':'.$host['port'], | ||
355 | 'tls' => 'tls://'.$host['host'].':'.$host['port'], | ||
356 | default => $host['path'], | ||
357 | }; | ||
358 | } | ||
359 | |||
360 | try { | ||
361 | $redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent'], $params['auth'] ?? '', ...\defined('Redis::SCAN_PREFIX') ? [$params['ssl'] ?? null] : []); | ||
362 | } catch (\RedisClusterException $e) { | ||
363 | throw new InvalidArgumentException('Redis connection failed: '.$e->getMessage()); | ||
364 | } | ||
365 | |||
366 | if (0 < $params['tcp_keepalive'] && (!$isRedisExt || \defined('Redis::OPT_TCP_KEEPALIVE'))) { | ||
367 | $redis->setOption($isRedisExt ? \Redis::OPT_TCP_KEEPALIVE : Relay::OPT_TCP_KEEPALIVE, $params['tcp_keepalive']); | ||
368 | } | ||
369 | $redis->setOption(\RedisCluster::OPT_SLAVE_FAILOVER, match ($params['failover']) { | ||
370 | 'error' => \RedisCluster::FAILOVER_ERROR, | ||
371 | 'distribute' => \RedisCluster::FAILOVER_DISTRIBUTE, | ||
372 | 'slaves' => \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES, | ||
373 | 'none' => \RedisCluster::FAILOVER_NONE, | ||
374 | }); | ||
375 | |||
376 | return $redis; | ||
377 | }; | ||
378 | |||
379 | $redis = $params['lazy'] ? RedisClusterProxy::createLazyProxy($initializer) : $initializer(); | ||
380 | } elseif (is_a($class, \Predis\ClientInterface::class, true)) { | ||
381 | if ($params['redis_cluster']) { | ||
382 | $params['cluster'] = 'redis'; | ||
383 | } elseif (isset($params['redis_sentinel'])) { | ||
384 | $params['replication'] = 'sentinel'; | ||
385 | $params['service'] = $params['redis_sentinel']; | ||
386 | } | ||
387 | $params += ['parameters' => []]; | ||
388 | $params['parameters'] += [ | ||
389 | 'persistent' => $params['persistent'], | ||
390 | 'timeout' => $params['timeout'], | ||
391 | 'read_write_timeout' => $params['read_timeout'], | ||
392 | 'tcp_nodelay' => true, | ||
393 | ]; | ||
394 | if ($params['dbindex']) { | ||
395 | $params['parameters']['database'] = $params['dbindex']; | ||
396 | } | ||
397 | if (null !== $auth) { | ||
398 | if (\is_array($auth)) { | ||
399 | // ACL | ||
400 | $params['parameters']['username'] = $auth[0]; | ||
401 | $params['parameters']['password'] = $auth[1]; | ||
402 | } else { | ||
403 | $params['parameters']['password'] = $auth; | ||
404 | } | ||
405 | } | ||
406 | |||
407 | if (isset($params['ssl'])) { | ||
408 | foreach ($hosts as $i => $host) { | ||
409 | $hosts[$i]['ssl'] ??= $params['ssl']; | ||
410 | } | ||
411 | } | ||
412 | |||
413 | if (1 === \count($hosts) && !($params['redis_cluster'] || $params['redis_sentinel'])) { | ||
414 | $hosts = $hosts[0]; | ||
415 | } elseif (\in_array($params['failover'], ['slaves', 'distribute'], true) && !isset($params['replication'])) { | ||
416 | $params['replication'] = true; | ||
417 | $hosts[0] += ['alias' => 'master']; | ||
418 | } | ||
419 | $params['exceptions'] = false; | ||
420 | |||
421 | $redis = new $class($hosts, array_diff_key($params, self::$defaultConnectionOptions)); | ||
422 | if (isset($params['redis_sentinel'])) { | ||
423 | $redis->getConnection()->setSentinelTimeout($params['timeout']); | ||
424 | } | ||
425 | } elseif (class_exists($class, false)) { | ||
426 | throw new InvalidArgumentException(sprintf('"%s" is not a subclass of "Redis", "RedisArray", "RedisCluster", "Relay\Relay" nor "Predis\ClientInterface".', $class)); | ||
427 | } else { | ||
428 | throw new InvalidArgumentException(sprintf('Class "%s" does not exist.', $class)); | ||
429 | } | ||
430 | |||
431 | return $redis; | ||
432 | } | ||
433 | |||
434 | protected function doFetch(array $ids): iterable | ||
435 | { | ||
436 | if (!$ids) { | ||
437 | return []; | ||
438 | } | ||
439 | |||
440 | $result = []; | ||
441 | |||
442 | if ($this->redis instanceof \Predis\ClientInterface && ($this->redis->getConnection() instanceof ClusterInterface || $this->redis->getConnection() instanceof Predis2ClusterInterface)) { | ||
443 | $values = $this->pipeline(function () use ($ids) { | ||
444 | foreach ($ids as $id) { | ||
445 | yield 'get' => [$id]; | ||
446 | } | ||
447 | }); | ||
448 | } else { | ||
449 | $values = $this->redis->mget($ids); | ||
450 | |||
451 | if (!\is_array($values) || \count($values) !== \count($ids)) { | ||
452 | return []; | ||
453 | } | ||
454 | |||
455 | $values = array_combine($ids, $values); | ||
456 | } | ||
457 | |||
458 | foreach ($values as $id => $v) { | ||
459 | if ($v) { | ||
460 | $result[$id] = $this->marshaller->unmarshall($v); | ||
461 | } | ||
462 | } | ||
463 | |||
464 | return $result; | ||
465 | } | ||
466 | |||
467 | protected function doHave(string $id): bool | ||
468 | { | ||
469 | return (bool) $this->redis->exists($id); | ||
470 | } | ||
471 | |||
472 | protected function doClear(string $namespace): bool | ||
473 | { | ||
474 | if ($this->redis instanceof \Predis\ClientInterface) { | ||
475 | $prefix = $this->redis->getOptions()->prefix ? $this->redis->getOptions()->prefix->getPrefix() : ''; | ||
476 | $prefixLen = \strlen($prefix ?? ''); | ||
477 | } | ||
478 | |||
479 | $cleared = true; | ||
480 | $hosts = $this->getHosts(); | ||
481 | $host = reset($hosts); | ||
482 | if ($host instanceof \Predis\Client && $host->getConnection() instanceof ReplicationInterface) { | ||
483 | // Predis supports info command only on the master in replication environments | ||
484 | $hosts = [$host->getClientFor('master')]; | ||
485 | } | ||
486 | |||
487 | foreach ($hosts as $host) { | ||
488 | if (!isset($namespace[0])) { | ||
489 | $cleared = $host->flushDb() && $cleared; | ||
490 | continue; | ||
491 | } | ||
492 | |||
493 | $info = $host->info('Server'); | ||
494 | $info = !$info instanceof ErrorInterface ? $info['Server'] ?? $info : ['redis_version' => '2.0']; | ||
495 | |||
496 | if ($host instanceof Relay) { | ||
497 | $prefix = Relay::SCAN_PREFIX & $host->getOption(Relay::OPT_SCAN) ? '' : $host->getOption(Relay::OPT_PREFIX); | ||
498 | $prefixLen = \strlen($host->getOption(Relay::OPT_PREFIX) ?? ''); | ||
499 | } elseif (!$host instanceof \Predis\ClientInterface) { | ||
500 | $prefix = \defined('Redis::SCAN_PREFIX') && (\Redis::SCAN_PREFIX & $host->getOption(\Redis::OPT_SCAN)) ? '' : $host->getOption(\Redis::OPT_PREFIX); | ||
501 | $prefixLen = \strlen($host->getOption(\Redis::OPT_PREFIX) ?? ''); | ||
502 | } | ||
503 | $pattern = $prefix.$namespace.'*'; | ||
504 | |||
505 | if (!version_compare($info['redis_version'], '2.8', '>=')) { | ||
506 | // As documented in Redis documentation (http://redis.io/commands/keys) using KEYS | ||
507 | // can hang your server when it is executed against large databases (millions of items). | ||
508 | // Whenever you hit this scale, you should really consider upgrading to Redis 2.8 or above. | ||
509 | $unlink = version_compare($info['redis_version'], '4.0', '>=') ? 'UNLINK' : 'DEL'; | ||
510 | $args = $this->redis instanceof \Predis\ClientInterface ? [0, $pattern] : [[$pattern], 0]; | ||
511 | $cleared = $host->eval("local keys=redis.call('KEYS',ARGV[1]) for i=1,#keys,5000 do redis.call('$unlink',unpack(keys,i,math.min(i+4999,#keys))) end return 1", $args[0], $args[1]) && $cleared; | ||
512 | continue; | ||
513 | } | ||
514 | |||
515 | $cursor = null; | ||
516 | do { | ||
517 | $keys = $host instanceof \Predis\ClientInterface ? $host->scan($cursor, 'MATCH', $pattern, 'COUNT', 1000) : $host->scan($cursor, $pattern, 1000); | ||
518 | if (isset($keys[1]) && \is_array($keys[1])) { | ||
519 | $cursor = $keys[0]; | ||
520 | $keys = $keys[1]; | ||
521 | } | ||
522 | if ($keys) { | ||
523 | if ($prefixLen) { | ||
524 | foreach ($keys as $i => $key) { | ||
525 | $keys[$i] = substr($key, $prefixLen); | ||
526 | } | ||
527 | } | ||
528 | $this->doDelete($keys); | ||
529 | } | ||
530 | } while ($cursor); | ||
531 | } | ||
532 | |||
533 | return $cleared; | ||
534 | } | ||
535 | |||
536 | protected function doDelete(array $ids): bool | ||
537 | { | ||
538 | if (!$ids) { | ||
539 | return true; | ||
540 | } | ||
541 | |||
542 | if ($this->redis instanceof \Predis\ClientInterface && ($this->redis->getConnection() instanceof ClusterInterface || $this->redis->getConnection() instanceof Predis2ClusterInterface)) { | ||
543 | static $del; | ||
544 | $del ??= (class_exists(UNLINK::class) ? 'unlink' : 'del'); | ||
545 | |||
546 | $this->pipeline(function () use ($ids, $del) { | ||
547 | foreach ($ids as $id) { | ||
548 | yield $del => [$id]; | ||
549 | } | ||
550 | })->rewind(); | ||
551 | } else { | ||
552 | static $unlink = true; | ||
553 | |||
554 | if ($unlink) { | ||
555 | try { | ||
556 | $unlink = false !== $this->redis->unlink($ids); | ||
557 | } catch (\Throwable) { | ||
558 | $unlink = false; | ||
559 | } | ||
560 | } | ||
561 | |||
562 | if (!$unlink) { | ||
563 | $this->redis->del($ids); | ||
564 | } | ||
565 | } | ||
566 | |||
567 | return true; | ||
568 | } | ||
569 | |||
570 | protected function doSave(array $values, int $lifetime): array|bool | ||
571 | { | ||
572 | if (!$values = $this->marshaller->marshall($values, $failed)) { | ||
573 | return $failed; | ||
574 | } | ||
575 | |||
576 | $results = $this->pipeline(function () use ($values, $lifetime) { | ||
577 | foreach ($values as $id => $value) { | ||
578 | if (0 >= $lifetime) { | ||
579 | yield 'set' => [$id, $value]; | ||
580 | } else { | ||
581 | yield 'setEx' => [$id, $lifetime, $value]; | ||
582 | } | ||
583 | } | ||
584 | }); | ||
585 | |||
586 | foreach ($results as $id => $result) { | ||
587 | if (true !== $result && (!$result instanceof Status || Status::get('OK') !== $result)) { | ||
588 | $failed[] = $id; | ||
589 | } | ||
590 | } | ||
591 | |||
592 | return $failed; | ||
593 | } | ||
594 | |||
595 | private function pipeline(\Closure $generator, ?object $redis = null): \Generator | ||
596 | { | ||
597 | $ids = []; | ||
598 | $redis ??= $this->redis; | ||
599 | |||
600 | if ($redis instanceof \RedisCluster || ($redis instanceof \Predis\ClientInterface && ($redis->getConnection() instanceof RedisCluster || $redis->getConnection() instanceof Predis2RedisCluster))) { | ||
601 | // phpredis & predis don't support pipelining with RedisCluster | ||
602 | // see https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#pipelining | ||
603 | // see https://github.com/nrk/predis/issues/267#issuecomment-123781423 | ||
604 | $results = []; | ||
605 | foreach ($generator() as $command => $args) { | ||
606 | $results[] = $redis->{$command}(...$args); | ||
607 | $ids[] = 'eval' === $command ? ($redis instanceof \Predis\ClientInterface ? $args[2] : $args[1][0]) : $args[0]; | ||
608 | } | ||
609 | } elseif ($redis instanceof \Predis\ClientInterface) { | ||
610 | $results = $redis->pipeline(static function ($redis) use ($generator, &$ids) { | ||
611 | foreach ($generator() as $command => $args) { | ||
612 | $redis->{$command}(...$args); | ||
613 | $ids[] = 'eval' === $command ? $args[2] : $args[0]; | ||
614 | } | ||
615 | }); | ||
616 | } elseif ($redis instanceof \RedisArray) { | ||
617 | $connections = $results = $ids = []; | ||
618 | foreach ($generator() as $command => $args) { | ||
619 | $id = 'eval' === $command ? $args[1][0] : $args[0]; | ||
620 | if (!isset($connections[$h = $redis->_target($id)])) { | ||
621 | $connections[$h] = [$redis->_instance($h), -1]; | ||
622 | $connections[$h][0]->multi(\Redis::PIPELINE); | ||
623 | } | ||
624 | $connections[$h][0]->{$command}(...$args); | ||
625 | $results[] = [$h, ++$connections[$h][1]]; | ||
626 | $ids[] = $id; | ||
627 | } | ||
628 | foreach ($connections as $h => $c) { | ||
629 | $connections[$h] = $c[0]->exec(); | ||
630 | } | ||
631 | foreach ($results as $k => [$h, $c]) { | ||
632 | $results[$k] = $connections[$h][$c]; | ||
633 | } | ||
634 | } else { | ||
635 | $redis->multi($redis instanceof Relay ? Relay::PIPELINE : \Redis::PIPELINE); | ||
636 | foreach ($generator() as $command => $args) { | ||
637 | $redis->{$command}(...$args); | ||
638 | $ids[] = 'eval' === $command ? $args[1][0] : $args[0]; | ||
639 | } | ||
640 | $results = $redis->exec(); | ||
641 | } | ||
642 | |||
643 | if (!$redis instanceof \Predis\ClientInterface && 'eval' === $command && $redis->getLastError()) { | ||
644 | $e = $redis instanceof Relay ? new \Relay\Exception($redis->getLastError()) : new \RedisException($redis->getLastError()); | ||
645 | $results = array_map(fn ($v) => false === $v ? $e : $v, (array) $results); | ||
646 | } | ||
647 | |||
648 | if (\is_bool($results)) { | ||
649 | return; | ||
650 | } | ||
651 | |||
652 | foreach ($ids as $k => $id) { | ||
653 | yield $id => $results[$k]; | ||
654 | } | ||
655 | } | ||
656 | |||
657 | private function getHosts(): array | ||
658 | { | ||
659 | $hosts = [$this->redis]; | ||
660 | if ($this->redis instanceof \Predis\ClientInterface) { | ||
661 | $connection = $this->redis->getConnection(); | ||
662 | if (($connection instanceof ClusterInterface || $connection instanceof Predis2ClusterInterface) && $connection instanceof \Traversable) { | ||
663 | $hosts = []; | ||
664 | foreach ($connection as $c) { | ||
665 | $hosts[] = new \Predis\Client($c); | ||
666 | } | ||
667 | } | ||
668 | } elseif ($this->redis instanceof \RedisArray) { | ||
669 | $hosts = []; | ||
670 | foreach ($this->redis->_hosts() as $host) { | ||
671 | $hosts[] = $this->redis->_instance($host); | ||
672 | } | ||
673 | } elseif ($this->redis instanceof \RedisCluster) { | ||
674 | $hosts = []; | ||
675 | foreach ($this->redis->_masters() as $host) { | ||
676 | $hosts[] = new RedisClusterNodeProxy($host, $this->redis); | ||
677 | } | ||
678 | } | ||
679 | |||
680 | return $hosts; | ||
681 | } | ||
682 | } | ||
diff --git a/vendor/symfony/cache/Traits/RelayProxy.php b/vendor/symfony/cache/Traits/RelayProxy.php new file mode 100644 index 0000000..96d7d19 --- /dev/null +++ b/vendor/symfony/cache/Traits/RelayProxy.php | |||
@@ -0,0 +1,1319 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | use Symfony\Component\VarExporter\LazyObjectInterface; | ||
15 | use Symfony\Component\VarExporter\LazyProxyTrait; | ||
16 | use Symfony\Contracts\Service\ResetInterface; | ||
17 | |||
18 | // Help opcache.preload discover always-needed symbols | ||
19 | class_exists(\Symfony\Component\VarExporter\Internal\Hydrator::class); | ||
20 | class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectRegistry::class); | ||
21 | class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectState::class); | ||
22 | |||
23 | /** | ||
24 | * @internal | ||
25 | */ | ||
26 | class RelayProxy extends \Relay\Relay implements ResetInterface, LazyObjectInterface | ||
27 | { | ||
28 | use LazyProxyTrait { | ||
29 | resetLazyObject as reset; | ||
30 | } | ||
31 | use RelayProxyTrait; | ||
32 | |||
33 | private const LAZY_OBJECT_PROPERTY_SCOPES = []; | ||
34 | |||
35 | public function __construct($host = null, $port = 6379, $connect_timeout = 0.0, $command_timeout = 0.0, #[\SensitiveParameter] $context = [], $database = 0) | ||
36 | { | ||
37 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->__construct(...\func_get_args()); | ||
38 | } | ||
39 | |||
40 | public function connect($host, $port = 6379, $timeout = 0.0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0.0, #[\SensitiveParameter] $context = [], $database = 0): bool | ||
41 | { | ||
42 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->connect(...\func_get_args()); | ||
43 | } | ||
44 | |||
45 | public function pconnect($host, $port = 6379, $timeout = 0.0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0.0, #[\SensitiveParameter] $context = [], $database = 0): bool | ||
46 | { | ||
47 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pconnect(...\func_get_args()); | ||
48 | } | ||
49 | |||
50 | public function close(): bool | ||
51 | { | ||
52 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->close(...\func_get_args()); | ||
53 | } | ||
54 | |||
55 | public function pclose(): bool | ||
56 | { | ||
57 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pclose(...\func_get_args()); | ||
58 | } | ||
59 | |||
60 | public function listen($callback): bool | ||
61 | { | ||
62 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->listen(...\func_get_args()); | ||
63 | } | ||
64 | |||
65 | public function onFlushed($callback): bool | ||
66 | { | ||
67 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->onFlushed(...\func_get_args()); | ||
68 | } | ||
69 | |||
70 | public function onInvalidated($callback, $pattern = null): bool | ||
71 | { | ||
72 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->onInvalidated(...\func_get_args()); | ||
73 | } | ||
74 | |||
75 | public function dispatchEvents(): false|int | ||
76 | { | ||
77 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dispatchEvents(...\func_get_args()); | ||
78 | } | ||
79 | |||
80 | public function getOption($option): mixed | ||
81 | { | ||
82 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getOption(...\func_get_args()); | ||
83 | } | ||
84 | |||
85 | public function option($option, $value = null): mixed | ||
86 | { | ||
87 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->option(...\func_get_args()); | ||
88 | } | ||
89 | |||
90 | public function setOption($option, $value): bool | ||
91 | { | ||
92 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setOption(...\func_get_args()); | ||
93 | } | ||
94 | |||
95 | public function addIgnorePatterns(...$pattern): int | ||
96 | { | ||
97 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->addIgnorePatterns(...\func_get_args()); | ||
98 | } | ||
99 | |||
100 | public function addAllowPatterns(...$pattern): int | ||
101 | { | ||
102 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->addAllowPatterns(...\func_get_args()); | ||
103 | } | ||
104 | |||
105 | public function getTimeout(): false|float | ||
106 | { | ||
107 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getTimeout(...\func_get_args()); | ||
108 | } | ||
109 | |||
110 | public function timeout(): false|float | ||
111 | { | ||
112 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->timeout(...\func_get_args()); | ||
113 | } | ||
114 | |||
115 | public function getReadTimeout(): false|float | ||
116 | { | ||
117 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getReadTimeout(...\func_get_args()); | ||
118 | } | ||
119 | |||
120 | public function readTimeout(): false|float | ||
121 | { | ||
122 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->readTimeout(...\func_get_args()); | ||
123 | } | ||
124 | |||
125 | public function getBytes(): array | ||
126 | { | ||
127 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getBytes(...\func_get_args()); | ||
128 | } | ||
129 | |||
130 | public function bytes(): array | ||
131 | { | ||
132 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bytes(...\func_get_args()); | ||
133 | } | ||
134 | |||
135 | public function getHost(): false|string | ||
136 | { | ||
137 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getHost(...\func_get_args()); | ||
138 | } | ||
139 | |||
140 | public function isConnected(): bool | ||
141 | { | ||
142 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->isConnected(...\func_get_args()); | ||
143 | } | ||
144 | |||
145 | public function getPort(): false|int | ||
146 | { | ||
147 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getPort(...\func_get_args()); | ||
148 | } | ||
149 | |||
150 | public function getAuth(): mixed | ||
151 | { | ||
152 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getAuth(...\func_get_args()); | ||
153 | } | ||
154 | |||
155 | public function getDbNum(): mixed | ||
156 | { | ||
157 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getDbNum(...\func_get_args()); | ||
158 | } | ||
159 | |||
160 | public function _serialize($value): mixed | ||
161 | { | ||
162 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_serialize(...\func_get_args()); | ||
163 | } | ||
164 | |||
165 | public function _unserialize($value): mixed | ||
166 | { | ||
167 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_unserialize(...\func_get_args()); | ||
168 | } | ||
169 | |||
170 | public function _compress($value): string | ||
171 | { | ||
172 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_compress(...\func_get_args()); | ||
173 | } | ||
174 | |||
175 | public function _uncompress($value): string | ||
176 | { | ||
177 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_uncompress(...\func_get_args()); | ||
178 | } | ||
179 | |||
180 | public function _pack($value): string | ||
181 | { | ||
182 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_pack(...\func_get_args()); | ||
183 | } | ||
184 | |||
185 | public function _unpack($value): mixed | ||
186 | { | ||
187 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_unpack(...\func_get_args()); | ||
188 | } | ||
189 | |||
190 | public function _prefix($value): string | ||
191 | { | ||
192 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_prefix(...\func_get_args()); | ||
193 | } | ||
194 | |||
195 | public function getLastError(): ?string | ||
196 | { | ||
197 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getLastError(...\func_get_args()); | ||
198 | } | ||
199 | |||
200 | public function clearLastError(): bool | ||
201 | { | ||
202 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->clearLastError(...\func_get_args()); | ||
203 | } | ||
204 | |||
205 | public function endpointId(): false|string | ||
206 | { | ||
207 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->endpointId(...\func_get_args()); | ||
208 | } | ||
209 | |||
210 | public function getPersistentID(): false|string | ||
211 | { | ||
212 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getPersistentID(...\func_get_args()); | ||
213 | } | ||
214 | |||
215 | public function socketId(): false|string | ||
216 | { | ||
217 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->socketId(...\func_get_args()); | ||
218 | } | ||
219 | |||
220 | public function rawCommand($cmd, ...$args): mixed | ||
221 | { | ||
222 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rawCommand(...\func_get_args()); | ||
223 | } | ||
224 | |||
225 | public function select($db): \Relay\Relay|bool | ||
226 | { | ||
227 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->select(...\func_get_args()); | ||
228 | } | ||
229 | |||
230 | public function auth(#[\SensitiveParameter] $auth): bool | ||
231 | { | ||
232 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->auth(...\func_get_args()); | ||
233 | } | ||
234 | |||
235 | public function info(...$sections): \Relay\Relay|array|false | ||
236 | { | ||
237 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->info(...\func_get_args()); | ||
238 | } | ||
239 | |||
240 | public function flushdb($sync = null): \Relay\Relay|bool | ||
241 | { | ||
242 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->flushdb(...\func_get_args()); | ||
243 | } | ||
244 | |||
245 | public function flushall($sync = null): \Relay\Relay|bool | ||
246 | { | ||
247 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->flushall(...\func_get_args()); | ||
248 | } | ||
249 | |||
250 | public function fcall($name, $keys = [], $argv = [], $handler = null): mixed | ||
251 | { | ||
252 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->fcall(...\func_get_args()); | ||
253 | } | ||
254 | |||
255 | public function fcall_ro($name, $keys = [], $argv = [], $handler = null): mixed | ||
256 | { | ||
257 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->fcall_ro(...\func_get_args()); | ||
258 | } | ||
259 | |||
260 | public function function($op, ...$args): mixed | ||
261 | { | ||
262 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->function(...\func_get_args()); | ||
263 | } | ||
264 | |||
265 | public function dbsize(): \Relay\Relay|false|int | ||
266 | { | ||
267 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dbsize(...\func_get_args()); | ||
268 | } | ||
269 | |||
270 | public function dump($key): \Relay\Relay|false|string | ||
271 | { | ||
272 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args()); | ||
273 | } | ||
274 | |||
275 | public function replicaof($host = null, $port = 0): \Relay\Relay|bool | ||
276 | { | ||
277 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->replicaof(...\func_get_args()); | ||
278 | } | ||
279 | |||
280 | public function waitaof($numlocal, $numremote, $timeout): \Relay\Relay|array|false | ||
281 | { | ||
282 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->waitaof(...\func_get_args()); | ||
283 | } | ||
284 | |||
285 | public function restore($key, $ttl, $value, $options = null): \Relay\Relay|bool | ||
286 | { | ||
287 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->restore(...\func_get_args()); | ||
288 | } | ||
289 | |||
290 | public function migrate($host, $port, $key, $dstdb, $timeout, $copy = false, $replace = false, #[\SensitiveParameter] $credentials = null): \Relay\Relay|bool | ||
291 | { | ||
292 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->migrate(...\func_get_args()); | ||
293 | } | ||
294 | |||
295 | public function echo($arg): \Relay\Relay|bool|string | ||
296 | { | ||
297 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->echo(...\func_get_args()); | ||
298 | } | ||
299 | |||
300 | public function ping($arg = null): \Relay\Relay|bool|string | ||
301 | { | ||
302 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ping(...\func_get_args()); | ||
303 | } | ||
304 | |||
305 | public function idleTime(): \Relay\Relay|false|int | ||
306 | { | ||
307 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->idleTime(...\func_get_args()); | ||
308 | } | ||
309 | |||
310 | public function randomkey(): \Relay\Relay|bool|null|string | ||
311 | { | ||
312 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->randomkey(...\func_get_args()); | ||
313 | } | ||
314 | |||
315 | public function time(): \Relay\Relay|array|false | ||
316 | { | ||
317 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->time(...\func_get_args()); | ||
318 | } | ||
319 | |||
320 | public function bgrewriteaof(): \Relay\Relay|bool | ||
321 | { | ||
322 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgrewriteaof(...\func_get_args()); | ||
323 | } | ||
324 | |||
325 | public function lastsave(): \Relay\Relay|false|int | ||
326 | { | ||
327 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lastsave(...\func_get_args()); | ||
328 | } | ||
329 | |||
330 | public function lcs($key1, $key2, $options = null): mixed | ||
331 | { | ||
332 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lcs(...\func_get_args()); | ||
333 | } | ||
334 | |||
335 | public function bgsave($schedule = false): \Relay\Relay|bool | ||
336 | { | ||
337 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgsave(...\func_get_args()); | ||
338 | } | ||
339 | |||
340 | public function save(): \Relay\Relay|bool | ||
341 | { | ||
342 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->save(...\func_get_args()); | ||
343 | } | ||
344 | |||
345 | public function role(): \Relay\Relay|array|false | ||
346 | { | ||
347 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->role(...\func_get_args()); | ||
348 | } | ||
349 | |||
350 | public function ttl($key): \Relay\Relay|false|int | ||
351 | { | ||
352 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ttl(...\func_get_args()); | ||
353 | } | ||
354 | |||
355 | public function pttl($key): \Relay\Relay|false|int | ||
356 | { | ||
357 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pttl(...\func_get_args()); | ||
358 | } | ||
359 | |||
360 | public function exists(...$keys): \Relay\Relay|bool|int | ||
361 | { | ||
362 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->exists(...\func_get_args()); | ||
363 | } | ||
364 | |||
365 | public function eval($script, $args = [], $num_keys = 0): mixed | ||
366 | { | ||
367 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->eval(...\func_get_args()); | ||
368 | } | ||
369 | |||
370 | public function eval_ro($script, $args = [], $num_keys = 0): mixed | ||
371 | { | ||
372 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->eval_ro(...\func_get_args()); | ||
373 | } | ||
374 | |||
375 | public function evalsha($sha, $args = [], $num_keys = 0): mixed | ||
376 | { | ||
377 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->evalsha(...\func_get_args()); | ||
378 | } | ||
379 | |||
380 | public function evalsha_ro($sha, $args = [], $num_keys = 0): mixed | ||
381 | { | ||
382 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->evalsha_ro(...\func_get_args()); | ||
383 | } | ||
384 | |||
385 | public function client($operation, ...$args): mixed | ||
386 | { | ||
387 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->client(...\func_get_args()); | ||
388 | } | ||
389 | |||
390 | public function geoadd($key, $lng, $lat, $member, ...$other_triples_and_options): \Relay\Relay|false|int | ||
391 | { | ||
392 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geoadd(...\func_get_args()); | ||
393 | } | ||
394 | |||
395 | public function geodist($key, $src, $dst, $unit = null): \Relay\Relay|false|float | ||
396 | { | ||
397 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geodist(...\func_get_args()); | ||
398 | } | ||
399 | |||
400 | public function geohash($key, $member, ...$other_members): \Relay\Relay|array|false | ||
401 | { | ||
402 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geohash(...\func_get_args()); | ||
403 | } | ||
404 | |||
405 | public function georadius($key, $lng, $lat, $radius, $unit, $options = []): mixed | ||
406 | { | ||
407 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadius(...\func_get_args()); | ||
408 | } | ||
409 | |||
410 | public function georadiusbymember($key, $member, $radius, $unit, $options = []): mixed | ||
411 | { | ||
412 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadiusbymember(...\func_get_args()); | ||
413 | } | ||
414 | |||
415 | public function georadiusbymember_ro($key, $member, $radius, $unit, $options = []): mixed | ||
416 | { | ||
417 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadiusbymember_ro(...\func_get_args()); | ||
418 | } | ||
419 | |||
420 | public function georadius_ro($key, $lng, $lat, $radius, $unit, $options = []): mixed | ||
421 | { | ||
422 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->georadius_ro(...\func_get_args()); | ||
423 | } | ||
424 | |||
425 | public function geosearch($key, $position, $shape, $unit, $options = []): \Relay\Relay|array | ||
426 | { | ||
427 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geosearch(...\func_get_args()); | ||
428 | } | ||
429 | |||
430 | public function geosearchstore($dst, $src, $position, $shape, $unit, $options = []): \Relay\Relay|false|int | ||
431 | { | ||
432 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geosearchstore(...\func_get_args()); | ||
433 | } | ||
434 | |||
435 | public function get($key): mixed | ||
436 | { | ||
437 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->get(...\func_get_args()); | ||
438 | } | ||
439 | |||
440 | public function getset($key, $value): mixed | ||
441 | { | ||
442 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getset(...\func_get_args()); | ||
443 | } | ||
444 | |||
445 | public function getrange($key, $start, $end): \Relay\Relay|false|string | ||
446 | { | ||
447 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getrange(...\func_get_args()); | ||
448 | } | ||
449 | |||
450 | public function setrange($key, $start, $value): \Relay\Relay|false|int | ||
451 | { | ||
452 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setrange(...\func_get_args()); | ||
453 | } | ||
454 | |||
455 | public function getbit($key, $pos): \Relay\Relay|false|int | ||
456 | { | ||
457 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getbit(...\func_get_args()); | ||
458 | } | ||
459 | |||
460 | public function bitcount($key, $start = 0, $end = -1, $by_bit = false): \Relay\Relay|false|int | ||
461 | { | ||
462 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitcount(...\func_get_args()); | ||
463 | } | ||
464 | |||
465 | public function bitfield($key, ...$args): \Relay\Relay|array|false | ||
466 | { | ||
467 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitfield(...\func_get_args()); | ||
468 | } | ||
469 | |||
470 | public function config($operation, $key = null, $value = null): \Relay\Relay|array|bool | ||
471 | { | ||
472 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->config(...\func_get_args()); | ||
473 | } | ||
474 | |||
475 | public function command(...$args): \Relay\Relay|array|false|int | ||
476 | { | ||
477 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->command(...\func_get_args()); | ||
478 | } | ||
479 | |||
480 | public function bitop($operation, $dstkey, $srckey, ...$other_keys): \Relay\Relay|false|int | ||
481 | { | ||
482 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitop(...\func_get_args()); | ||
483 | } | ||
484 | |||
485 | public function bitpos($key, $bit, $start = null, $end = null, $bybit = false): \Relay\Relay|false|int | ||
486 | { | ||
487 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bitpos(...\func_get_args()); | ||
488 | } | ||
489 | |||
490 | public function setbit($key, $pos, $val): \Relay\Relay|false|int | ||
491 | { | ||
492 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setbit(...\func_get_args()); | ||
493 | } | ||
494 | |||
495 | public function acl($cmd, ...$args): mixed | ||
496 | { | ||
497 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->acl(...\func_get_args()); | ||
498 | } | ||
499 | |||
500 | public function append($key, $value): \Relay\Relay|false|int | ||
501 | { | ||
502 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->append(...\func_get_args()); | ||
503 | } | ||
504 | |||
505 | public function set($key, $value, $options = null): mixed | ||
506 | { | ||
507 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->set(...\func_get_args()); | ||
508 | } | ||
509 | |||
510 | public function getex($key, $options = null): mixed | ||
511 | { | ||
512 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getex(...\func_get_args()); | ||
513 | } | ||
514 | |||
515 | public function getdel($key): mixed | ||
516 | { | ||
517 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getdel(...\func_get_args()); | ||
518 | } | ||
519 | |||
520 | public function setex($key, $seconds, $value): \Relay\Relay|bool | ||
521 | { | ||
522 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setex(...\func_get_args()); | ||
523 | } | ||
524 | |||
525 | public function pfadd($key, $elements): \Relay\Relay|false|int | ||
526 | { | ||
527 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfadd(...\func_get_args()); | ||
528 | } | ||
529 | |||
530 | public function pfcount($key): \Relay\Relay|false|int | ||
531 | { | ||
532 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfcount(...\func_get_args()); | ||
533 | } | ||
534 | |||
535 | public function pfmerge($dst, $srckeys): \Relay\Relay|bool | ||
536 | { | ||
537 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfmerge(...\func_get_args()); | ||
538 | } | ||
539 | |||
540 | public function psetex($key, $milliseconds, $value): \Relay\Relay|bool | ||
541 | { | ||
542 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->psetex(...\func_get_args()); | ||
543 | } | ||
544 | |||
545 | public function publish($channel, $message): \Relay\Relay|false|int | ||
546 | { | ||
547 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->publish(...\func_get_args()); | ||
548 | } | ||
549 | |||
550 | public function pubsub($operation, ...$args): mixed | ||
551 | { | ||
552 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pubsub(...\func_get_args()); | ||
553 | } | ||
554 | |||
555 | public function spublish($channel, $message): \Relay\Relay|false|int | ||
556 | { | ||
557 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->spublish(...\func_get_args()); | ||
558 | } | ||
559 | |||
560 | public function setnx($key, $value): \Relay\Relay|bool | ||
561 | { | ||
562 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->setnx(...\func_get_args()); | ||
563 | } | ||
564 | |||
565 | public function mget($keys): \Relay\Relay|array|false | ||
566 | { | ||
567 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mget(...\func_get_args()); | ||
568 | } | ||
569 | |||
570 | public function move($key, $db): \Relay\Relay|false|int | ||
571 | { | ||
572 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->move(...\func_get_args()); | ||
573 | } | ||
574 | |||
575 | public function mset($kvals): \Relay\Relay|bool | ||
576 | { | ||
577 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mset(...\func_get_args()); | ||
578 | } | ||
579 | |||
580 | public function msetnx($kvals): \Relay\Relay|bool | ||
581 | { | ||
582 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->msetnx(...\func_get_args()); | ||
583 | } | ||
584 | |||
585 | public function rename($key, $newkey): \Relay\Relay|bool | ||
586 | { | ||
587 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rename(...\func_get_args()); | ||
588 | } | ||
589 | |||
590 | public function renamenx($key, $newkey): \Relay\Relay|bool | ||
591 | { | ||
592 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->renamenx(...\func_get_args()); | ||
593 | } | ||
594 | |||
595 | public function del(...$keys): \Relay\Relay|bool|int | ||
596 | { | ||
597 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->del(...\func_get_args()); | ||
598 | } | ||
599 | |||
600 | public function unlink(...$keys): \Relay\Relay|false|int | ||
601 | { | ||
602 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unlink(...\func_get_args()); | ||
603 | } | ||
604 | |||
605 | public function expire($key, $seconds, $mode = null): \Relay\Relay|bool | ||
606 | { | ||
607 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expire(...\func_get_args()); | ||
608 | } | ||
609 | |||
610 | public function pexpire($key, $milliseconds): \Relay\Relay|bool | ||
611 | { | ||
612 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpire(...\func_get_args()); | ||
613 | } | ||
614 | |||
615 | public function expireat($key, $timestamp): \Relay\Relay|bool | ||
616 | { | ||
617 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expireat(...\func_get_args()); | ||
618 | } | ||
619 | |||
620 | public function expiretime($key): \Relay\Relay|false|int | ||
621 | { | ||
622 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->expiretime(...\func_get_args()); | ||
623 | } | ||
624 | |||
625 | public function pexpireat($key, $timestamp_ms): \Relay\Relay|bool | ||
626 | { | ||
627 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpireat(...\func_get_args()); | ||
628 | } | ||
629 | |||
630 | public function pexpiretime($key): \Relay\Relay|false|int | ||
631 | { | ||
632 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pexpiretime(...\func_get_args()); | ||
633 | } | ||
634 | |||
635 | public function persist($key): \Relay\Relay|bool | ||
636 | { | ||
637 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->persist(...\func_get_args()); | ||
638 | } | ||
639 | |||
640 | public function type($key): \Relay\Relay|bool|int|string | ||
641 | { | ||
642 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->type(...\func_get_args()); | ||
643 | } | ||
644 | |||
645 | public function lmove($srckey, $dstkey, $srcpos, $dstpos): \Relay\Relay|false|null|string | ||
646 | { | ||
647 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lmove(...\func_get_args()); | ||
648 | } | ||
649 | |||
650 | public function blmove($srckey, $dstkey, $srcpos, $dstpos, $timeout): \Relay\Relay|false|null|string | ||
651 | { | ||
652 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blmove(...\func_get_args()); | ||
653 | } | ||
654 | |||
655 | public function lrange($key, $start, $stop): \Relay\Relay|array|false | ||
656 | { | ||
657 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lrange(...\func_get_args()); | ||
658 | } | ||
659 | |||
660 | public function lpush($key, $mem, ...$mems): \Relay\Relay|false|int | ||
661 | { | ||
662 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lpush(...\func_get_args()); | ||
663 | } | ||
664 | |||
665 | public function rpush($key, $mem, ...$mems): \Relay\Relay|false|int | ||
666 | { | ||
667 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpush(...\func_get_args()); | ||
668 | } | ||
669 | |||
670 | public function lpushx($key, $mem, ...$mems): \Relay\Relay|false|int | ||
671 | { | ||
672 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lpushx(...\func_get_args()); | ||
673 | } | ||
674 | |||
675 | public function rpushx($key, $mem, ...$mems): \Relay\Relay|false|int | ||
676 | { | ||
677 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpushx(...\func_get_args()); | ||
678 | } | ||
679 | |||
680 | public function lset($key, $index, $mem): \Relay\Relay|bool | ||
681 | { | ||
682 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lset(...\func_get_args()); | ||
683 | } | ||
684 | |||
685 | public function lpop($key, $count = 1): mixed | ||
686 | { | ||
687 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lpop(...\func_get_args()); | ||
688 | } | ||
689 | |||
690 | public function lpos($key, $value, $options = null): \Relay\Relay|array|false|int|null | ||
691 | { | ||
692 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lpos(...\func_get_args()); | ||
693 | } | ||
694 | |||
695 | public function rpop($key, $count = 1): mixed | ||
696 | { | ||
697 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpop(...\func_get_args()); | ||
698 | } | ||
699 | |||
700 | public function rpoplpush($source, $dest): mixed | ||
701 | { | ||
702 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->rpoplpush(...\func_get_args()); | ||
703 | } | ||
704 | |||
705 | public function brpoplpush($source, $dest, $timeout): mixed | ||
706 | { | ||
707 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->brpoplpush(...\func_get_args()); | ||
708 | } | ||
709 | |||
710 | public function blpop($key, $timeout_or_key, ...$extra_args): \Relay\Relay|array|false|null | ||
711 | { | ||
712 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blpop(...\func_get_args()); | ||
713 | } | ||
714 | |||
715 | public function blmpop($timeout, $keys, $from, $count = 1): \Relay\Relay|array|false|null | ||
716 | { | ||
717 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blmpop(...\func_get_args()); | ||
718 | } | ||
719 | |||
720 | public function bzmpop($timeout, $keys, $from, $count = 1): \Relay\Relay|array|false|null | ||
721 | { | ||
722 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzmpop(...\func_get_args()); | ||
723 | } | ||
724 | |||
725 | public function lmpop($keys, $from, $count = 1): \Relay\Relay|array|false|null | ||
726 | { | ||
727 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lmpop(...\func_get_args()); | ||
728 | } | ||
729 | |||
730 | public function zmpop($keys, $from, $count = 1): \Relay\Relay|array|false|null | ||
731 | { | ||
732 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zmpop(...\func_get_args()); | ||
733 | } | ||
734 | |||
735 | public function brpop($key, $timeout_or_key, ...$extra_args): \Relay\Relay|array|false|null | ||
736 | { | ||
737 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->brpop(...\func_get_args()); | ||
738 | } | ||
739 | |||
740 | public function bzpopmax($key, $timeout_or_key, ...$extra_args): \Relay\Relay|array|false|null | ||
741 | { | ||
742 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzpopmax(...\func_get_args()); | ||
743 | } | ||
744 | |||
745 | public function bzpopmin($key, $timeout_or_key, ...$extra_args): \Relay\Relay|array|false|null | ||
746 | { | ||
747 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bzpopmin(...\func_get_args()); | ||
748 | } | ||
749 | |||
750 | public function object($op, $key): mixed | ||
751 | { | ||
752 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->object(...\func_get_args()); | ||
753 | } | ||
754 | |||
755 | public function geopos($key, ...$members): \Relay\Relay|array|false | ||
756 | { | ||
757 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geopos(...\func_get_args()); | ||
758 | } | ||
759 | |||
760 | public function lrem($key, $mem, $count = 0): \Relay\Relay|false|int | ||
761 | { | ||
762 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lrem(...\func_get_args()); | ||
763 | } | ||
764 | |||
765 | public function lindex($key, $index): mixed | ||
766 | { | ||
767 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lindex(...\func_get_args()); | ||
768 | } | ||
769 | |||
770 | public function linsert($key, $op, $pivot, $element): \Relay\Relay|false|int | ||
771 | { | ||
772 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->linsert(...\func_get_args()); | ||
773 | } | ||
774 | |||
775 | public function ltrim($key, $start, $end): \Relay\Relay|bool | ||
776 | { | ||
777 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ltrim(...\func_get_args()); | ||
778 | } | ||
779 | |||
780 | public function hget($hash, $member): mixed | ||
781 | { | ||
782 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hget(...\func_get_args()); | ||
783 | } | ||
784 | |||
785 | public function hstrlen($hash, $member): \Relay\Relay|false|int | ||
786 | { | ||
787 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hstrlen(...\func_get_args()); | ||
788 | } | ||
789 | |||
790 | public function hgetall($hash): \Relay\Relay|array|false | ||
791 | { | ||
792 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hgetall(...\func_get_args()); | ||
793 | } | ||
794 | |||
795 | public function hkeys($hash): \Relay\Relay|array|false | ||
796 | { | ||
797 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hkeys(...\func_get_args()); | ||
798 | } | ||
799 | |||
800 | public function hvals($hash): \Relay\Relay|array|false | ||
801 | { | ||
802 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hvals(...\func_get_args()); | ||
803 | } | ||
804 | |||
805 | public function hmget($hash, $members): \Relay\Relay|array|false | ||
806 | { | ||
807 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hmget(...\func_get_args()); | ||
808 | } | ||
809 | |||
810 | public function hrandfield($hash, $options = null): \Relay\Relay|array|false|string | ||
811 | { | ||
812 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hrandfield(...\func_get_args()); | ||
813 | } | ||
814 | |||
815 | public function hmset($hash, $members): \Relay\Relay|bool | ||
816 | { | ||
817 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hmset(...\func_get_args()); | ||
818 | } | ||
819 | |||
820 | public function hexists($hash, $member): \Relay\Relay|bool | ||
821 | { | ||
822 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hexists(...\func_get_args()); | ||
823 | } | ||
824 | |||
825 | public function hsetnx($hash, $member, $value): \Relay\Relay|bool | ||
826 | { | ||
827 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hsetnx(...\func_get_args()); | ||
828 | } | ||
829 | |||
830 | public function hset($key, $mem, $val, ...$kvals): \Relay\Relay|false|int | ||
831 | { | ||
832 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hset(...\func_get_args()); | ||
833 | } | ||
834 | |||
835 | public function hdel($key, $mem, ...$mems): \Relay\Relay|false|int | ||
836 | { | ||
837 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hdel(...\func_get_args()); | ||
838 | } | ||
839 | |||
840 | public function hincrby($key, $mem, $value): \Relay\Relay|false|int | ||
841 | { | ||
842 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hincrby(...\func_get_args()); | ||
843 | } | ||
844 | |||
845 | public function hincrbyfloat($key, $mem, $value): \Relay\Relay|bool|float | ||
846 | { | ||
847 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hincrbyfloat(...\func_get_args()); | ||
848 | } | ||
849 | |||
850 | public function incr($key, $by = 1): \Relay\Relay|false|int | ||
851 | { | ||
852 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incr(...\func_get_args()); | ||
853 | } | ||
854 | |||
855 | public function decr($key, $by = 1): \Relay\Relay|false|int | ||
856 | { | ||
857 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->decr(...\func_get_args()); | ||
858 | } | ||
859 | |||
860 | public function incrby($key, $value): \Relay\Relay|false|int | ||
861 | { | ||
862 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incrby(...\func_get_args()); | ||
863 | } | ||
864 | |||
865 | public function decrby($key, $value): \Relay\Relay|false|int | ||
866 | { | ||
867 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->decrby(...\func_get_args()); | ||
868 | } | ||
869 | |||
870 | public function incrbyfloat($key, $value): \Relay\Relay|false|float | ||
871 | { | ||
872 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->incrbyfloat(...\func_get_args()); | ||
873 | } | ||
874 | |||
875 | public function sdiff($key, ...$other_keys): \Relay\Relay|array|false | ||
876 | { | ||
877 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sdiff(...\func_get_args()); | ||
878 | } | ||
879 | |||
880 | public function sdiffstore($key, ...$other_keys): \Relay\Relay|false|int | ||
881 | { | ||
882 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sdiffstore(...\func_get_args()); | ||
883 | } | ||
884 | |||
885 | public function sinter($key, ...$other_keys): \Relay\Relay|array|false | ||
886 | { | ||
887 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sinter(...\func_get_args()); | ||
888 | } | ||
889 | |||
890 | public function sintercard($keys, $limit = -1): \Relay\Relay|false|int | ||
891 | { | ||
892 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sintercard(...\func_get_args()); | ||
893 | } | ||
894 | |||
895 | public function sinterstore($key, ...$other_keys): \Relay\Relay|false|int | ||
896 | { | ||
897 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sinterstore(...\func_get_args()); | ||
898 | } | ||
899 | |||
900 | public function sunion($key, ...$other_keys): \Relay\Relay|array|false | ||
901 | { | ||
902 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sunion(...\func_get_args()); | ||
903 | } | ||
904 | |||
905 | public function sunionstore($key, ...$other_keys): \Relay\Relay|false|int | ||
906 | { | ||
907 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sunionstore(...\func_get_args()); | ||
908 | } | ||
909 | |||
910 | public function subscribe($channels, $callback): bool | ||
911 | { | ||
912 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->subscribe(...\func_get_args()); | ||
913 | } | ||
914 | |||
915 | public function unsubscribe($channels = []): bool | ||
916 | { | ||
917 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unsubscribe(...\func_get_args()); | ||
918 | } | ||
919 | |||
920 | public function psubscribe($patterns, $callback): bool | ||
921 | { | ||
922 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->psubscribe(...\func_get_args()); | ||
923 | } | ||
924 | |||
925 | public function punsubscribe($patterns = []): bool | ||
926 | { | ||
927 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->punsubscribe(...\func_get_args()); | ||
928 | } | ||
929 | |||
930 | public function ssubscribe($channels, $callback): bool | ||
931 | { | ||
932 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ssubscribe(...\func_get_args()); | ||
933 | } | ||
934 | |||
935 | public function sunsubscribe($channels = []): bool | ||
936 | { | ||
937 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sunsubscribe(...\func_get_args()); | ||
938 | } | ||
939 | |||
940 | public function touch($key_or_array, ...$more_keys): \Relay\Relay|false|int | ||
941 | { | ||
942 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->touch(...\func_get_args()); | ||
943 | } | ||
944 | |||
945 | public function pipeline(): \Relay\Relay|bool | ||
946 | { | ||
947 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pipeline(...\func_get_args()); | ||
948 | } | ||
949 | |||
950 | public function multi($mode = 0): \Relay\Relay|bool | ||
951 | { | ||
952 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->multi(...\func_get_args()); | ||
953 | } | ||
954 | |||
955 | public function exec(): \Relay\Relay|array|bool | ||
956 | { | ||
957 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->exec(...\func_get_args()); | ||
958 | } | ||
959 | |||
960 | public function wait($replicas, $timeout): \Relay\Relay|false|int | ||
961 | { | ||
962 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->wait(...\func_get_args()); | ||
963 | } | ||
964 | |||
965 | public function watch($key, ...$other_keys): \Relay\Relay|bool | ||
966 | { | ||
967 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->watch(...\func_get_args()); | ||
968 | } | ||
969 | |||
970 | public function unwatch(): \Relay\Relay|bool | ||
971 | { | ||
972 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->unwatch(...\func_get_args()); | ||
973 | } | ||
974 | |||
975 | public function discard(): bool | ||
976 | { | ||
977 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->discard(...\func_get_args()); | ||
978 | } | ||
979 | |||
980 | public function getMode($masked = false): int | ||
981 | { | ||
982 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getMode(...\func_get_args()); | ||
983 | } | ||
984 | |||
985 | public function clearBytes(): void | ||
986 | { | ||
987 | ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->clearBytes(...\func_get_args()); | ||
988 | } | ||
989 | |||
990 | public function scan(&$iterator, $match = null, $count = 0, $type = null): array|false | ||
991 | { | ||
992 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->scan($iterator, ...\array_slice(\func_get_args(), 1)); | ||
993 | } | ||
994 | |||
995 | public function hscan($key, &$iterator, $match = null, $count = 0): array|false | ||
996 | { | ||
997 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hscan($key, $iterator, ...\array_slice(\func_get_args(), 2)); | ||
998 | } | ||
999 | |||
1000 | public function sscan($key, &$iterator, $match = null, $count = 0): array|false | ||
1001 | { | ||
1002 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sscan($key, $iterator, ...\array_slice(\func_get_args(), 2)); | ||
1003 | } | ||
1004 | |||
1005 | public function zscan($key, &$iterator, $match = null, $count = 0): array|false | ||
1006 | { | ||
1007 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscan($key, $iterator, ...\array_slice(\func_get_args(), 2)); | ||
1008 | } | ||
1009 | |||
1010 | public function keys($pattern): \Relay\Relay|array|false | ||
1011 | { | ||
1012 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->keys(...\func_get_args()); | ||
1013 | } | ||
1014 | |||
1015 | public function slowlog($operation, ...$extra_args): \Relay\Relay|array|bool|int | ||
1016 | { | ||
1017 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->slowlog(...\func_get_args()); | ||
1018 | } | ||
1019 | |||
1020 | public function smembers($set): \Relay\Relay|array|false | ||
1021 | { | ||
1022 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->smembers(...\func_get_args()); | ||
1023 | } | ||
1024 | |||
1025 | public function sismember($set, $member): \Relay\Relay|bool | ||
1026 | { | ||
1027 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sismember(...\func_get_args()); | ||
1028 | } | ||
1029 | |||
1030 | public function smismember($set, ...$members): \Relay\Relay|array|false | ||
1031 | { | ||
1032 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->smismember(...\func_get_args()); | ||
1033 | } | ||
1034 | |||
1035 | public function srem($set, $member, ...$members): \Relay\Relay|false|int | ||
1036 | { | ||
1037 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->srem(...\func_get_args()); | ||
1038 | } | ||
1039 | |||
1040 | public function sadd($set, $member, ...$members): \Relay\Relay|false|int | ||
1041 | { | ||
1042 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sadd(...\func_get_args()); | ||
1043 | } | ||
1044 | |||
1045 | public function sort($key, $options = []): \Relay\Relay|array|false|int | ||
1046 | { | ||
1047 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sort(...\func_get_args()); | ||
1048 | } | ||
1049 | |||
1050 | public function sort_ro($key, $options = []): \Relay\Relay|array|false | ||
1051 | { | ||
1052 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sort_ro(...\func_get_args()); | ||
1053 | } | ||
1054 | |||
1055 | public function smove($srcset, $dstset, $member): \Relay\Relay|bool | ||
1056 | { | ||
1057 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->smove(...\func_get_args()); | ||
1058 | } | ||
1059 | |||
1060 | public function spop($set, $count = 1): mixed | ||
1061 | { | ||
1062 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->spop(...\func_get_args()); | ||
1063 | } | ||
1064 | |||
1065 | public function srandmember($set, $count = 1): mixed | ||
1066 | { | ||
1067 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->srandmember(...\func_get_args()); | ||
1068 | } | ||
1069 | |||
1070 | public function scard($key): \Relay\Relay|false|int | ||
1071 | { | ||
1072 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->scard(...\func_get_args()); | ||
1073 | } | ||
1074 | |||
1075 | public function script($command, ...$args): mixed | ||
1076 | { | ||
1077 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->script(...\func_get_args()); | ||
1078 | } | ||
1079 | |||
1080 | public function strlen($key): \Relay\Relay|false|int | ||
1081 | { | ||
1082 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->strlen(...\func_get_args()); | ||
1083 | } | ||
1084 | |||
1085 | public function hlen($key): \Relay\Relay|false|int | ||
1086 | { | ||
1087 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hlen(...\func_get_args()); | ||
1088 | } | ||
1089 | |||
1090 | public function llen($key): \Relay\Relay|false|int | ||
1091 | { | ||
1092 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->llen(...\func_get_args()); | ||
1093 | } | ||
1094 | |||
1095 | public function xack($key, $group, $ids): \Relay\Relay|false|int | ||
1096 | { | ||
1097 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xack(...\func_get_args()); | ||
1098 | } | ||
1099 | |||
1100 | public function xadd($key, $id, $values, $maxlen = 0, $approx = false, $nomkstream = false): \Relay\Relay|false|string | ||
1101 | { | ||
1102 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xadd(...\func_get_args()); | ||
1103 | } | ||
1104 | |||
1105 | public function xclaim($key, $group, $consumer, $min_idle, $ids, $options): \Relay\Relay|array|bool | ||
1106 | { | ||
1107 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xclaim(...\func_get_args()); | ||
1108 | } | ||
1109 | |||
1110 | public function xautoclaim($key, $group, $consumer, $min_idle, $start, $count = -1, $justid = false): \Relay\Relay|array|bool | ||
1111 | { | ||
1112 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xautoclaim(...\func_get_args()); | ||
1113 | } | ||
1114 | |||
1115 | public function xlen($key): \Relay\Relay|false|int | ||
1116 | { | ||
1117 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xlen(...\func_get_args()); | ||
1118 | } | ||
1119 | |||
1120 | public function xgroup($operation, $key = null, $group = null, $id_or_consumer = null, $mkstream = false, $entries_read = -2): mixed | ||
1121 | { | ||
1122 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xgroup(...\func_get_args()); | ||
1123 | } | ||
1124 | |||
1125 | public function xdel($key, $ids): \Relay\Relay|false|int | ||
1126 | { | ||
1127 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xdel(...\func_get_args()); | ||
1128 | } | ||
1129 | |||
1130 | public function xinfo($operation, $arg1 = null, $arg2 = null, $count = -1): mixed | ||
1131 | { | ||
1132 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xinfo(...\func_get_args()); | ||
1133 | } | ||
1134 | |||
1135 | public function xpending($key, $group, $start = null, $end = null, $count = -1, $consumer = null, $idle = 0): \Relay\Relay|array|false | ||
1136 | { | ||
1137 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xpending(...\func_get_args()); | ||
1138 | } | ||
1139 | |||
1140 | public function xrange($key, $start, $end, $count = -1): \Relay\Relay|array|false | ||
1141 | { | ||
1142 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xrange(...\func_get_args()); | ||
1143 | } | ||
1144 | |||
1145 | public function xrevrange($key, $end, $start, $count = -1): \Relay\Relay|array|bool | ||
1146 | { | ||
1147 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xrevrange(...\func_get_args()); | ||
1148 | } | ||
1149 | |||
1150 | public function xread($streams, $count = -1, $block = -1): \Relay\Relay|array|bool|null | ||
1151 | { | ||
1152 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xread(...\func_get_args()); | ||
1153 | } | ||
1154 | |||
1155 | public function xreadgroup($group, $consumer, $streams, $count = 1, $block = 1): \Relay\Relay|array|bool|null | ||
1156 | { | ||
1157 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xreadgroup(...\func_get_args()); | ||
1158 | } | ||
1159 | |||
1160 | public function xtrim($key, $threshold, $approx = false, $minid = false, $limit = -1): \Relay\Relay|false|int | ||
1161 | { | ||
1162 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xtrim(...\func_get_args()); | ||
1163 | } | ||
1164 | |||
1165 | public function zadd($key, ...$args): mixed | ||
1166 | { | ||
1167 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zadd(...\func_get_args()); | ||
1168 | } | ||
1169 | |||
1170 | public function zrandmember($key, $options = null): mixed | ||
1171 | { | ||
1172 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrandmember(...\func_get_args()); | ||
1173 | } | ||
1174 | |||
1175 | public function zrange($key, $start, $end, $options = null): \Relay\Relay|array|false | ||
1176 | { | ||
1177 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrange(...\func_get_args()); | ||
1178 | } | ||
1179 | |||
1180 | public function zrevrange($key, $start, $end, $options = null): \Relay\Relay|array|false | ||
1181 | { | ||
1182 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrange(...\func_get_args()); | ||
1183 | } | ||
1184 | |||
1185 | public function zrangebyscore($key, $start, $end, $options = null): \Relay\Relay|array|false | ||
1186 | { | ||
1187 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrangebyscore(...\func_get_args()); | ||
1188 | } | ||
1189 | |||
1190 | public function zrevrangebyscore($key, $start, $end, $options = null): \Relay\Relay|array|false | ||
1191 | { | ||
1192 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrangebyscore(...\func_get_args()); | ||
1193 | } | ||
1194 | |||
1195 | public function zrangestore($dst, $src, $start, $end, $options = null): \Relay\Relay|false|int | ||
1196 | { | ||
1197 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrangestore(...\func_get_args()); | ||
1198 | } | ||
1199 | |||
1200 | public function zrangebylex($key, $min, $max, $offset = -1, $count = -1): \Relay\Relay|array|false | ||
1201 | { | ||
1202 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrangebylex(...\func_get_args()); | ||
1203 | } | ||
1204 | |||
1205 | public function zrevrangebylex($key, $max, $min, $offset = -1, $count = -1): \Relay\Relay|array|false | ||
1206 | { | ||
1207 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrangebylex(...\func_get_args()); | ||
1208 | } | ||
1209 | |||
1210 | public function zrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int | ||
1211 | { | ||
1212 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrank(...\func_get_args()); | ||
1213 | } | ||
1214 | |||
1215 | public function zrevrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int | ||
1216 | { | ||
1217 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrank(...\func_get_args()); | ||
1218 | } | ||
1219 | |||
1220 | public function zrem($key, ...$args): \Relay\Relay|false|int | ||
1221 | { | ||
1222 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrem(...\func_get_args()); | ||
1223 | } | ||
1224 | |||
1225 | public function zremrangebylex($key, $min, $max): \Relay\Relay|false|int | ||
1226 | { | ||
1227 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zremrangebylex(...\func_get_args()); | ||
1228 | } | ||
1229 | |||
1230 | public function zremrangebyrank($key, $start, $end): \Relay\Relay|false|int | ||
1231 | { | ||
1232 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zremrangebyrank(...\func_get_args()); | ||
1233 | } | ||
1234 | |||
1235 | public function zremrangebyscore($key, $min, $max): \Relay\Relay|false|int | ||
1236 | { | ||
1237 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zremrangebyscore(...\func_get_args()); | ||
1238 | } | ||
1239 | |||
1240 | public function zcard($key): \Relay\Relay|false|int | ||
1241 | { | ||
1242 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zcard(...\func_get_args()); | ||
1243 | } | ||
1244 | |||
1245 | public function zcount($key, $min, $max): \Relay\Relay|false|int | ||
1246 | { | ||
1247 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zcount(...\func_get_args()); | ||
1248 | } | ||
1249 | |||
1250 | public function zdiff($keys, $options = null): \Relay\Relay|array|false | ||
1251 | { | ||
1252 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zdiff(...\func_get_args()); | ||
1253 | } | ||
1254 | |||
1255 | public function zdiffstore($dst, $keys): \Relay\Relay|false|int | ||
1256 | { | ||
1257 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zdiffstore(...\func_get_args()); | ||
1258 | } | ||
1259 | |||
1260 | public function zincrby($key, $score, $mem): \Relay\Relay|false|float | ||
1261 | { | ||
1262 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zincrby(...\func_get_args()); | ||
1263 | } | ||
1264 | |||
1265 | public function zlexcount($key, $min, $max): \Relay\Relay|false|int | ||
1266 | { | ||
1267 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zlexcount(...\func_get_args()); | ||
1268 | } | ||
1269 | |||
1270 | public function zmscore($key, ...$mems): \Relay\Relay|array|false | ||
1271 | { | ||
1272 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zmscore(...\func_get_args()); | ||
1273 | } | ||
1274 | |||
1275 | public function zscore($key, $member): \Relay\Relay|false|float | ||
1276 | { | ||
1277 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscore(...\func_get_args()); | ||
1278 | } | ||
1279 | |||
1280 | public function zinter($keys, $weights = null, $options = null): \Relay\Relay|array|false | ||
1281 | { | ||
1282 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zinter(...\func_get_args()); | ||
1283 | } | ||
1284 | |||
1285 | public function zintercard($keys, $limit = -1): \Relay\Relay|false|int | ||
1286 | { | ||
1287 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zintercard(...\func_get_args()); | ||
1288 | } | ||
1289 | |||
1290 | public function zinterstore($dst, $keys, $weights = null, $options = null): \Relay\Relay|false|int | ||
1291 | { | ||
1292 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zinterstore(...\func_get_args()); | ||
1293 | } | ||
1294 | |||
1295 | public function zunion($keys, $weights = null, $options = null): \Relay\Relay|array|false | ||
1296 | { | ||
1297 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zunion(...\func_get_args()); | ||
1298 | } | ||
1299 | |||
1300 | public function zunionstore($dst, $keys, $weights = null, $options = null): \Relay\Relay|false|int | ||
1301 | { | ||
1302 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zunionstore(...\func_get_args()); | ||
1303 | } | ||
1304 | |||
1305 | public function zpopmin($key, $count = 1): \Relay\Relay|array|false | ||
1306 | { | ||
1307 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zpopmin(...\func_get_args()); | ||
1308 | } | ||
1309 | |||
1310 | public function zpopmax($key, $count = 1): \Relay\Relay|array|false | ||
1311 | { | ||
1312 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zpopmax(...\func_get_args()); | ||
1313 | } | ||
1314 | |||
1315 | public function _getKeys() | ||
1316 | { | ||
1317 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->_getKeys(...\func_get_args()); | ||
1318 | } | ||
1319 | } | ||
diff --git a/vendor/symfony/cache/Traits/RelayProxyTrait.php b/vendor/symfony/cache/Traits/RelayProxyTrait.php new file mode 100644 index 0000000..a1d252b --- /dev/null +++ b/vendor/symfony/cache/Traits/RelayProxyTrait.php | |||
@@ -0,0 +1,156 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Cache\Traits; | ||
13 | |||
14 | if (version_compare(phpversion('relay'), '0.8.1', '>=')) { | ||
15 | /** | ||
16 | * @internal | ||
17 | */ | ||
18 | trait RelayProxyTrait | ||
19 | { | ||
20 | public function copy($src, $dst, $options = null): \Relay\Relay|bool | ||
21 | { | ||
22 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args()); | ||
23 | } | ||
24 | |||
25 | public function jsonArrAppend($key, $value_or_array, $path = null): \Relay\Relay|array|false | ||
26 | { | ||
27 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrAppend(...\func_get_args()); | ||
28 | } | ||
29 | |||
30 | public function jsonArrIndex($key, $path, $value, $start = 0, $stop = -1): \Relay\Relay|array|false | ||
31 | { | ||
32 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrIndex(...\func_get_args()); | ||
33 | } | ||
34 | |||
35 | public function jsonArrInsert($key, $path, $index, $value, ...$other_values): \Relay\Relay|array|false | ||
36 | { | ||
37 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrInsert(...\func_get_args()); | ||
38 | } | ||
39 | |||
40 | public function jsonArrLen($key, $path = null): \Relay\Relay|array|false | ||
41 | { | ||
42 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrLen(...\func_get_args()); | ||
43 | } | ||
44 | |||
45 | public function jsonArrPop($key, $path = null, $index = -1): \Relay\Relay|array|false | ||
46 | { | ||
47 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrPop(...\func_get_args()); | ||
48 | } | ||
49 | |||
50 | public function jsonArrTrim($key, $path, $start, $stop): \Relay\Relay|array|false | ||
51 | { | ||
52 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrTrim(...\func_get_args()); | ||
53 | } | ||
54 | |||
55 | public function jsonClear($key, $path = null): \Relay\Relay|false|int | ||
56 | { | ||
57 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonClear(...\func_get_args()); | ||
58 | } | ||
59 | |||
60 | public function jsonDebug($command, $key, $path = null): \Relay\Relay|false|int | ||
61 | { | ||
62 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonDebug(...\func_get_args()); | ||
63 | } | ||
64 | |||
65 | public function jsonDel($key, $path = null): \Relay\Relay|false|int | ||
66 | { | ||
67 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonDel(...\func_get_args()); | ||
68 | } | ||
69 | |||
70 | public function jsonForget($key, $path = null): \Relay\Relay|false|int | ||
71 | { | ||
72 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonForget(...\func_get_args()); | ||
73 | } | ||
74 | |||
75 | public function jsonGet($key, $options = [], ...$paths): mixed | ||
76 | { | ||
77 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonGet(...\func_get_args()); | ||
78 | } | ||
79 | |||
80 | public function jsonMerge($key, $path, $value): \Relay\Relay|bool | ||
81 | { | ||
82 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonMerge(...\func_get_args()); | ||
83 | } | ||
84 | |||
85 | public function jsonMget($key_or_array, $path): \Relay\Relay|array|false | ||
86 | { | ||
87 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonMget(...\func_get_args()); | ||
88 | } | ||
89 | |||
90 | public function jsonMset($key, $path, $value, ...$other_triples): \Relay\Relay|bool | ||
91 | { | ||
92 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonMset(...\func_get_args()); | ||
93 | } | ||
94 | |||
95 | public function jsonNumIncrBy($key, $path, $value): \Relay\Relay|array|false | ||
96 | { | ||
97 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonNumIncrBy(...\func_get_args()); | ||
98 | } | ||
99 | |||
100 | public function jsonNumMultBy($key, $path, $value): \Relay\Relay|array|false | ||
101 | { | ||
102 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonNumMultBy(...\func_get_args()); | ||
103 | } | ||
104 | |||
105 | public function jsonObjKeys($key, $path = null): \Relay\Relay|array|false | ||
106 | { | ||
107 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonObjKeys(...\func_get_args()); | ||
108 | } | ||
109 | |||
110 | public function jsonObjLen($key, $path = null): \Relay\Relay|array|false | ||
111 | { | ||
112 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonObjLen(...\func_get_args()); | ||
113 | } | ||
114 | |||
115 | public function jsonResp($key, $path = null): \Relay\Relay|array|false|int|string | ||
116 | { | ||
117 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonResp(...\func_get_args()); | ||
118 | } | ||
119 | |||
120 | public function jsonSet($key, $path, $value, $condition = null): \Relay\Relay|bool | ||
121 | { | ||
122 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonSet(...\func_get_args()); | ||
123 | } | ||
124 | |||
125 | public function jsonStrAppend($key, $value, $path = null): \Relay\Relay|array|false | ||
126 | { | ||
127 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonStrAppend(...\func_get_args()); | ||
128 | } | ||
129 | |||
130 | public function jsonStrLen($key, $path = null): \Relay\Relay|array|false | ||
131 | { | ||
132 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonStrLen(...\func_get_args()); | ||
133 | } | ||
134 | |||
135 | public function jsonToggle($key, $path): \Relay\Relay|array|false | ||
136 | { | ||
137 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonToggle(...\func_get_args()); | ||
138 | } | ||
139 | |||
140 | public function jsonType($key, $path = null): \Relay\Relay|array|false | ||
141 | { | ||
142 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonType(...\func_get_args()); | ||
143 | } | ||
144 | } | ||
145 | } else { | ||
146 | /** | ||
147 | * @internal | ||
148 | */ | ||
149 | trait RelayProxyTrait | ||
150 | { | ||
151 | public function copy($src, $dst, $options = null): \Relay\Relay|false|int | ||
152 | { | ||
153 | return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args()); | ||
154 | } | ||
155 | } | ||
156 | } | ||
diff --git a/vendor/symfony/cache/Traits/ValueWrapper.php b/vendor/symfony/cache/Traits/ValueWrapper.php new file mode 100644 index 0000000..718a23d --- /dev/null +++ b/vendor/symfony/cache/Traits/ValueWrapper.php | |||
@@ -0,0 +1,81 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | /** | ||
13 | * A short namespace-less class to serialize items with metadata. | ||
14 | * | ||
15 | * @author Nicolas Grekas <p@tchwork.com> | ||
16 | * | ||
17 | * @internal | ||
18 | */ | ||
19 | class © | ||
20 | { | ||
21 | private const EXPIRY_OFFSET = 1648206727; | ||
22 | private const INT32_MAX = 2147483647; | ||
23 | |||
24 | public readonly mixed $value; | ||
25 | public readonly array $metadata; | ||
26 | |||
27 | public function __construct(mixed $value, array $metadata) | ||
28 | { | ||
29 | $this->value = $value; | ||
30 | $this->metadata = $metadata; | ||
31 | } | ||
32 | |||
33 | public function __serialize(): array | ||
34 | { | ||
35 | // pack 31-bits ctime into 14bits | ||
36 | $c = $this->metadata['ctime'] ?? 0; | ||
37 | $c = match (true) { | ||
38 | $c > self::INT32_MAX - 2 => self::INT32_MAX, | ||
39 | $c > 0 => 1 + $c, | ||
40 | default => 1, | ||
41 | }; | ||
42 | $e = 0; | ||
43 | while (!(0x40000000 & $c)) { | ||
44 | $c <<= 1; | ||
45 | ++$e; | ||
46 | } | ||
47 | $c = (0x7FE0 & ($c >> 16)) | $e; | ||
48 | |||
49 | $pack = pack('Vn', (int) (0.1 + ($this->metadata['expiry'] ?: self::INT32_MAX + self::EXPIRY_OFFSET) - self::EXPIRY_OFFSET), $c); | ||
50 | |||
51 | if (isset($this->metadata['tags'])) { | ||
52 | $pack[4] = $pack[4] | "\x80"; | ||
53 | } | ||
54 | |||
55 | return [$pack => $this->value] + ($this->metadata['tags'] ?? []); | ||
56 | } | ||
57 | |||
58 | public function __unserialize(array $data): void | ||
59 | { | ||
60 | $pack = array_key_first($data); | ||
61 | $this->value = $data[$pack]; | ||
62 | |||
63 | if ($hasTags = "\x80" === ($pack[4] & "\x80")) { | ||
64 | unset($data[$pack]); | ||
65 | $pack[4] = $pack[4] & "\x7F"; | ||
66 | } | ||
67 | |||
68 | $metadata = unpack('Vexpiry/nctime', $pack); | ||
69 | $metadata['expiry'] += self::EXPIRY_OFFSET; | ||
70 | |||
71 | if (!$metadata['ctime'] = ((0x4000 | $metadata['ctime']) << 16 >> (0x1F & $metadata['ctime'])) - 1) { | ||
72 | unset($metadata['ctime']); | ||
73 | } | ||
74 | |||
75 | if ($hasTags) { | ||
76 | $metadata['tags'] = $data; | ||
77 | } | ||
78 | |||
79 | $this->metadata = $metadata; | ||
80 | } | ||
81 | } | ||
diff --git a/vendor/symfony/cache/composer.json b/vendor/symfony/cache/composer.json new file mode 100644 index 0000000..d537037 --- /dev/null +++ b/vendor/symfony/cache/composer.json | |||
@@ -0,0 +1,60 @@ | |||
1 | { | ||
2 | "name": "symfony/cache", | ||
3 | "type": "library", | ||
4 | "description": "Provides extended PSR-6, PSR-16 (and tags) implementations", | ||
5 | "keywords": ["caching", "psr6"], | ||
6 | "homepage": "https://symfony.com", | ||
7 | "license": "MIT", | ||
8 | "authors": [ | ||
9 | { | ||
10 | "name": "Nicolas Grekas", | ||
11 | "email": "p@tchwork.com" | ||
12 | }, | ||
13 | { | ||
14 | "name": "Symfony Community", | ||
15 | "homepage": "https://symfony.com/contributors" | ||
16 | } | ||
17 | ], | ||
18 | "provide": { | ||
19 | "psr/cache-implementation": "2.0|3.0", | ||
20 | "psr/simple-cache-implementation": "1.0|2.0|3.0", | ||
21 | "symfony/cache-implementation": "1.1|2.0|3.0" | ||
22 | }, | ||
23 | "require": { | ||
24 | "php": ">=8.2", | ||
25 | "psr/cache": "^2.0|^3.0", | ||
26 | "psr/log": "^1.1|^2|^3", | ||
27 | "symfony/cache-contracts": "^2.5|^3", | ||
28 | "symfony/deprecation-contracts": "^2.5|^3.0", | ||
29 | "symfony/service-contracts": "^2.5|^3", | ||
30 | "symfony/var-exporter": "^6.4|^7.0" | ||
31 | }, | ||
32 | "require-dev": { | ||
33 | "cache/integration-tests": "dev-master", | ||
34 | "doctrine/dbal": "^3.6|^4", | ||
35 | "predis/predis": "^1.1|^2.0", | ||
36 | "psr/simple-cache": "^1.0|^2.0|^3.0", | ||
37 | "symfony/config": "^6.4|^7.0", | ||
38 | "symfony/dependency-injection": "^6.4|^7.0", | ||
39 | "symfony/filesystem": "^6.4|^7.0", | ||
40 | "symfony/http-kernel": "^6.4|^7.0", | ||
41 | "symfony/messenger": "^6.4|^7.0", | ||
42 | "symfony/var-dumper": "^6.4|^7.0" | ||
43 | }, | ||
44 | "conflict": { | ||
45 | "doctrine/dbal": "<3.6", | ||
46 | "symfony/dependency-injection": "<6.4", | ||
47 | "symfony/http-kernel": "<6.4", | ||
48 | "symfony/var-dumper": "<6.4" | ||
49 | }, | ||
50 | "autoload": { | ||
51 | "psr-4": { "Symfony\\Component\\Cache\\": "" }, | ||
52 | "classmap": [ | ||
53 | "Traits/ValueWrapper.php" | ||
54 | ], | ||
55 | "exclude-from-classmap": [ | ||
56 | "/Tests/" | ||
57 | ] | ||
58 | }, | ||
59 | "minimum-stability": "dev" | ||
60 | } | ||