- Issue created by @mandclu
- π©πͺGermany jurgenhaas Gottmadingen
The information on the project page is slightly outdated, as no configuration is required any longer. The module now recognizes the best available caching backend. However, it currently still only supports Redis or the file system. Here is how that's being done:
if ($redis = Settings::get('redis.connection')) { $dns = 'redis://' . ($redis['host'] ?? 'localhost') . ':' . ($redis['port'] ?? '6379'); $this->cache = new Redis(['redis_dsn' => $dns], $this->logger); } else { $this->cache = new PhpFiles(['fs_cache_path' => $this->fileSystem->getTempDirectory() . '/crowdsec'], $this->logger); }
In order to also support Memcached, I need some help from somebody who's used that with Drupal before. Here are 2 questions:
- How can we recognize that the current Drupal site uses Memcached? As for Redis, this is done by checking for
Settings::get('redis.connection')
.. Is there something similarly available for Memcached? - To initialize the Memcached backend for the CrowdSec library, they need a value for
memcached_dsn
. How would that DSN look like and is that information available from Drupal settings for us to re-use that or do we have to provide some configuration for the site builder to provide that information manually?
- How can we recognize that the current Drupal site uses Memcached? As for Redis, this is done by checking for
- @jurgenhaas opened merge request.
- Status changed to Needs review
about 1 year ago 8:33am 20 April 2023 - π©πͺGermany jurgenhaas Gottmadingen
Thanks to the help from @IT-Cru I've started the memcached support. Just not sure about the exact DNS that is required to communicate with memcached, but hopefully somebody can give this a try and let me know, if anything needs to be adjusted.
It's now implemented such that it looks for the Redis backend first, Memcached second, and if none of them were available, it falls back to the file system.