8000 [Cache] Redis: Do not remove items expired due to a time discrepancy · symfony/symfony@5af1ff6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5af1ff6

Browse files
committed
[Cache] Redis: Do not remove items expired due to a time discrepancy
1 parent 4856f04 commit 5af1ff6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,17 @@ public function clear(string $prefix = ''): bool
120120
return parent::clear($prefix);
121121
}
122122

123+
/**
124+
* {@inheritdoc}
125+
*/
126+
protected function evictExpiredItems(array $expiredItemKeys)
127+
{
128+
// Although it's better to remove big stale items explicitly to free up the memory for recomputed values,
129+
// thereby preventing possible evictions of other still fresh items, we keep these keys for other clients
130+
// as a measure of stampede protection in multi-server setups assuming that we got these keys most likely
131+
// because of (presumably small) time discrepancy between hosts. Anyway, Redis will delete them soon.
132+
}
133+
123134
/**
124135
* {@inheritdoc}
125136
*/

0 commit comments

Comments
 (0)
0