You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/cache/adapters/redis_adapter.rst
+16-12Lines changed: 16 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -220,19 +220,8 @@ Available Options
220
220
221
221
.. _redis-tag-aware-adapter:
222
222
223
-
Working with Tags
224
-
-----------------
225
-
226
-
In order to use tag-based invalidation, you can wrap your adapter in :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter`, but when Redis is used as backend, it's often more interesting to use the dedicated :class:`Symfony\\Component\\Cache\\Adapter\\RedisTagAwareAdapter`. Since tag invalidation logic is implemented in Redis itself, this adapter offers better performance when using tag-based invalidation::
227
-
228
-
use Symfony\Component\Cache\Adapter\RedisAdapter;
229
-
use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter;
When using Redis as cache, you should configure the ``maxmemory`` and ``maxmemory-policy``
238
227
settings. By setting ``maxmemory``, you limit how much memory Redis is allowed to consume.
@@ -247,6 +236,21 @@ try to add data when no memory is available. An example setting could look as fo
247
236
maxmemory 100mb
248
237
maxmemory-policy allkeys-lru
249
238
239
+
Working with Tags
240
+
-----------------
241
+
242
+
In order to use tag-based invalidation, you can wrap your adapter in :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter`, but when Redis is used as backend, it's often more interesting to use the dedicated :class:`Symfony\\Component\\Cache\\Adapter\\RedisTagAwareAdapter`. Since tag invalidation logic is implemented in Redis itself, this adapter offers better performance when using tag-based invalidation::
243
+
244
+
use Symfony\Component\Cache\Adapter\RedisAdapter;
245
+
use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter;
When using RedisTagAwareAdapter, in order to maintain relationships between tags and cache items, you have to use either ``noeviction`` or ``volatile-*`` in the Redis ``maxmemory-policy`` eviction policy.
253
+
250
254
Read more about this topic in the official `Redis LRU Cache Documentation`_.
251
255
252
256
.. _`Data Source Name (DSN)`: https://en.wikipedia.org/wiki/Data_source_name
0 commit comments