Skip to content

Commit 4bf4759

Browse files
Add documentation about redis cache configuration
1 parent 81d633b commit 4bf4759

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

components/cache/adapters/redis_adapter.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,17 @@ In order to use tag-based invalidation, you can wrap your adapter in :class:`Sym
201201
$client = RedisAdapter::createConnection('redis://localhost');
202202
$cache = new RedisTagAwareAdapter($client);
203203

204+
Configuring Redis
205+
~~~~~~~~~~~~~~~~~
206+
207+
When redis is used as cache its recommended to configure the `maxmemory` and `maxmemory-policy`
208+
read more about this dopic in the offical `Redis LRU Cache Documentation`_. Normally the redis
209+
config can be found int `/etc/redis/redis.conf`. The `maxmemory` depend on the usage of the cache
210+
to low it could kickout things which could be still important, to high could end in using too
211+
much memory:
212+
213+
maxmemory 100mb
214+
maxmemory-policy allkeys-lru
204215

205216
.. _`Data Source Name (DSN)`: https://en.wikipedia.org/wiki/Data_source_name
206217
.. _`Redis server`: https://redis.io/
@@ -211,3 +222,4 @@ In order to use tag-based invalidation, you can wrap your adapter in :class:`Sym
211222
.. _`Predis Connection Parameters`: https://github.com/nrk/predis/wiki/Connection-Parameters#list-of-connection-parameters
212223
.. _`TCP-keepalive`: https://redis.io/topics/clients#tcp-keepalive
213224
.. _`Redis Sentinel`: https://redis.io/topics/sentinel
225+
.. _`Redis LRU Cache Documentation`: https://redis.io/topics/lru-cache

0 commit comments

Comments
 (0)