feat(cache): Add ability for optional custom prefix for Redis/Memcached cache keys#58334
feat(cache): Add ability for optional custom prefix for Redis/Memcached cache keys#58334Earl0fPudding wants to merge 6 commits intonextcloud:masterfrom
Conversation
Signed-off-by: Martin <31348196+Earl0fPudding@users.noreply.github.com>
|
Backport to v32 would be perfect. |
|
Thanks for your pr 👍 This should be implemented in https://github.com/nextcloud/server/blob/master/lib/private/Memcache/Factory.php |
Signed-off-by: Martin <31348196+Earl0fPudding@users.noreply.github.com>
Signed-off-by: Martin <31348196+Earl0fPudding@users.noreply.github.com>
|
Thank you for your feedback, @kesselb ! |
|
PR for documentation: nextcloud/documentation#14080 |
|
/backport to stable32 |
….php Signed-off-by: Martin <31348196+Earl0fPudding@users.noreply.github.com>
lib/private/Memcache/Factory.php
Outdated
| $instanceid = $config->getValue('instanceid'); | ||
| $installedApps = implode(',', array_keys($versions)) . implode(',', array_values($versions)); | ||
| $this->globalPrefix = hash('xxh128', $instanceid . $installedApps); | ||
| $this->globalPrefix = $customprefix . ($customprefix != '' ? '/' : '') . hash('xxh128', $instanceid . $installedApps); |
There was a problem hiding this comment.
| $this->globalPrefix = $customprefix . ($customprefix != '' ? '/' : '') . hash('xxh128', $instanceid . $installedApps); | |
| $this->globalPrefix = $customprefix . hash('xxh128', $instanceid . $installedApps); |
I would prefer the above version to keep it simple.
Signed-off-by: Martin <31348196+Earl0fPudding@users.noreply.github.com>
| protected function getGlobalPrefix(): string { | ||
| if ($this->globalPrefix === null) { | ||
| $config = Server::get(SystemConfig::class); | ||
| $customprefix = $config->getValue('memcache_customprefix', ''); |
There was a problem hiding this comment.
Should be added to nextcloud/server/config/config.sample.php I think (as well as documentation in https://github.com/nextcloud/documentation/ ).
There was a problem hiding this comment.
Thank you very much! I've now added an example config for the new variable.
Regarding documentation, I've already created PR nextcloud/documentation#14080
Signed-off-by: Martin <31348196+Earl0fPudding@users.noreply.github.com>
Summary
This adds the ability to use a custom prefix for Redis and Memcached keys. This is an optional variable.
One can use the variable setting
memcache_customprefixfor this.Documentation PR: nextcloud/documentation#14080
Checklist
3. to review, feature component)stable32)