Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9e47ba

Browse files
committed
Update doc & review fixes
1 parent 85dd875 commit f9e47ba

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@
1818
use Symfony\Component\Cache\Traits\RedisTrait;
1919

2020
/**
21-
* Stores tag id <> cache id relationship as a Redis Set, lookup on invalidation using sPOP.
21+
* Stores tag id <> cache id relationship as a Redis Set, lookup on invalidation using RENAME+SMEMBERS.
2222
*
2323
* Set (tag relation info) is stored without expiry (non-volatile), while cache always gets an expiry (volatile) even
2424
* if not set by caller. Thus if you configure redis with the right eviction policy you can be safe this tag <> cache
2525
* relationship survives eviction (cache cleanup when Redis runs out of memory).
2626
*
2727
* Requirements:
2828
* - Client: PHP Redis or Predis
29-
* Due to lack of RENAME support it is not recommended to use PredisCluster, instead use RedisCluster.
29+
* Note: Due to lack of RENAME support it is NOT recommended to use Cluster on Predis, instead use phpredis.
3030
* - Server: Redis 2.8+
3131
* Configured with any `volatile-*` eviction policy, OR `noeviction` if it will NEVER fill up memory
3232
*
3333
* Design limitations:
3434
* - Max 4 billion cache keys per cache tag as limited by Redis Set datatype.
35-
* E.g. If you use a "all" items tag for expiry instead of clear(), that limits you to 4 billion cache items as well.
35+
* E.g. If you use a "all" items tag for expiry instead of clear(), that limits you to 4 billion cache items also.
3636
*
3737
* @see https://redis.io/topics/lru-cache#eviction-policies Documentation for Redis eviction policies.
3838
* @see https://redis.io/topics/data-types#sets Documentation for Redis Set datatype.
@@ -144,10 +144,7 @@ protected function doDelete(array $ids, array $tagData = []): bool
144144
protected function doInvalidate(array $tagIds): bool
145145
{
146146
if ($this->redis instanceof \Predis\ClientInterface && $this->redis->getConnection() instanceof ClusterInterface) {
147-
CacheItem::log(
148-
$this->logger,
149-
'Cluster on Predis does not support RENAME so there is a risk of race conditions on tag invalidation, please use phpredis instead.'
150-
);
147+
CacheItem::log($this->logger, 'Cluster on Predis does not support RENAME so there is a risk of race conditions on tag invalidation, use phpredis instead.');
151148
$movedTagSetIds = $tagIds;
152149
} else {
153150
$movedTagSetIds = $this->renameKeys($tagIds);
@@ -179,13 +176,13 @@ protected function doInvalidate(array $tagIds): bool
179176
/**
180177
* Rename several keys in order to be able to operate on them without risk of race conditions.
181178
*
182-
* Filters out keys that does not exists before returning new keys.
179+
* Filters out keys that does not exist before returning new keys.
183180
*
184181
* @see https://redis.io/commands/rename
185182
*
186-
* @param array $ids the Orginal cache id's
183+
* @param array $ids The original cache ids
187184
*
188-
* @return array filtered list of the valid moved keys (only those that existed)
185+
* @return array Filtered list of the valid moved keys (only those that existed)
189186
*/
190187
private function renameKeys(array $ids): array
191188
{

0 commit comments

Comments
 (0)