Skip to content
16 changes: 16 additions & 0 deletions admin_manual/configuration_server/caching_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ The following options are available to configure when using a single redis serve
'memcache.locking' => '\OC\Memcache\Redis',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.local' =>'\OC\Memcache\Redis' ,
'memcache_customprefix' => 'mynextcloudprefix',
'redis' => [
// 'host' => see connection parameters below
// 'port' => see connection parameters below
Expand All @@ -202,6 +203,7 @@ The following options are available to configure when using a redis cluster (all
'memcache.locking' => '\OC\Memcache\Redis',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.local' =>'\OC\Memcache\Redis' ,
'memcache_customprefix' => 'mynextcloudprefix',
'redis.cluster' => [
'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required
'cache-cluster:7000',
Expand Down Expand Up @@ -374,3 +376,17 @@ Cache Directory location
The cache directory defaults to ``data/$user/cache`` where ``$user`` is the
current user. You may use the ``'cache_path'`` directive in ``config.php``
(See :doc:`config_sample_php_parameters`) to select a different location.

Cache Key Prefix for Redis or Memcached
---------------------------------

By default, Nextcloud generates a semi-unique prefix for cache keys using information like instance ID, version etc. to mitigate the problem of
collisions when using the same cache for multiple Nextcloud instances.
If you want to make sure to prevent collisions alltogether, you can use the following
setting to define your custom prefix::

'memcache_customprefix' => 'mynextcloudprefix',

This also allows you to create ACLs in Redis and limit the keys specific users can access
(e.g. if you want to isolate specific Nextcloud instances when using the same cache).
This may be security-relevant for you.
15 changes: 15 additions & 0 deletions admin_manual/configuration_server/config_sample_php_parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2717,6 +2717,21 @@ Memory caching backend for locally stored data

Defaults to ``none``

memcache_customprefix
^^^^^^^^^^^^^^^^^^^^^


::

'memcache_customprefix' => 'mynextcloudprefix',

Custom cache key prefix for Redis or Memcached

* Used for avoiding collisions in the cache system
* May be used for ACL restrictions in Redis

Defaults to an auto-generated, semi-unique ID

memcache.distributed
^^^^^^^^^^^^^^^^^^^^

Expand Down
1 change: 1 addition & 0 deletions admin_manual/installation/example_centos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ Example config::
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'memcache.local' => '\OC\Memcache\APCu',
'memcache_customprefix' => 'nextcloud_centos',
'redis' => array(
'host' => 'localhost',
'port' => 6379,
Expand Down