@@ -193,6 +193,23 @@ In order to use tag-based invalidation, you can wrap your adapter in :class:`Sym
193
193
$client = RedisAdapter::createConnection('redis://localhost');
194
194
$cache = new RedisTagAwareAdapter($client);
195
195
196
+ Configuring Redis
197
+ ~~~~~~~~~~~~~~~~~
198
+
199
+ When using Redis as cache, you should configure the ``maxmemory `` and ``maxmemory-policy ``
200
+ settings. By setting ``maxmemory ``, you limit how much memory Redis is allowed to consume.
201
+ If the amount is too low, Redis will drop entries that would still be useful and you benefit
202
+ less from your cache. Setting the ``maxmemory-policy `` to ``allkeys-lru `` tells Redis that
203
+ it is ok to drop data when it runs out of memory, and to first drop the oldest entries (least
204
+ recently used). If you do not allow Redis to drop entries, it will return an error when you
205
+ try to add data when no memory is available. An example setting could look as follows:
206
+
207
+ .. code-block :: ini
208
+
209
+ maxmemory 100mb
210
+ maxmemory-policy allkeys-lru
211
+
212
+ Read more about this topic in the offical `Redis LRU Cache Documentation `_.
196
213
197
214
.. _`Data Source Name (DSN)` : https://en.wikipedia.org/wiki/Data_source_name
198
215
.. _`Redis server` : https://redis.io/
@@ -203,3 +220,4 @@ In order to use tag-based invalidation, you can wrap your adapter in :class:`Sym
203
220
.. _`Predis Connection Parameters` : https://github.com/nrk/predis/wiki/Connection-Parameters#list-of-connection-parameters
204
221
.. _`TCP-keepalive` : https://redis.io/topics/clients#tcp-keepalive
205
222
.. _`Redis Sentinel` : https://redis.io/topics/sentinel
223
+ .. _`Redis LRU Cache Documentation` : https://redis.io/topics/lru-cache
0 commit comments