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
@@ -228,19 +228,8 @@ Available Options
228
228
229
229
.. _redis-tag-aware-adapter:
230
230
231
-
Working with Tags
232
-
-----------------
233
-
234
-
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::
235
-
236
-
use Symfony\Component\Cache\Adapter\RedisAdapter;
237
-
use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter;
When using Redis as cache, you should configure the ``maxmemory`` and ``maxmemory-policy``
246
235
settings. By setting ``maxmemory``, you limit how much memory Redis is allowed to consume.
@@ -255,6 +244,21 @@ try to add data when no memory is available. An example setting could look as fo
255
244
maxmemory 100mb
256
245
maxmemory-policy allkeys-lru
257
246
247
+
Working with Tags
248
+
-----------------
249
+
250
+
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::
251
+
252
+
use Symfony\Component\Cache\Adapter\RedisAdapter;
253
+
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.
261
+
258
262
Read more about this topic in the official `Redis LRU Cache Documentation`_.
259
263
260
264
.. _`Data Source Name (DSN)`: https://en.wikipedia.org/wiki/Data_source_name
0 commit comments