Moodle Memcached plugin and AWS ElastiCache Auto Discovery

Moodle Memcached plugin and AWS ElastiCache Auto Discovery

by Manuel Quiñones -
Number of replies: 0

Hi,

After getting Moodle application cache working with AWS Memcached service ElastiCache, I now would like to take advantage of that service feature: nodes Auto Discovery.

This requires two things:

  1. Install a custom Memcached PHP client provided by AWS. Which I did in my CentOS 7 system by uninstalling php-pecl-memcached package first and then following these steps.
  2. Modify the application, which in the case of Moodle I think is a matter of modifying the Memcached plugin shipped with Moodle. 

As I'm new to modifying Moodle, I would like to know if this patch I made would do the trick or not (considering the AWS documentation):


--- a/path/to/moodle/cache/stores/memcached/lib.php-orig
+++ b/path/to/moodle/cache/stores/memcached/lib.php
@@ -132,6 +132,7 @@ class cachestore_memcached extends cache_store implements cache_is_configurable
         $this->options[Memcached::OPT_PREFIX_KEY] = $prefix;
         $this->options[Memcached::OPT_HASH] = $hashmethod;
         $this->options[Memcached::OPT_BUFFER_WRITES] = $bufferwrites;
+        $this->options[Memcached::OPT_CLIENT_MODE] = Memcached::DYNAMIC_CLIENT_MODE;

         $this->connection = new Memcached(crc32($this->name));
         $servers = $this->connection->getServerList();

If it does, do you think is worth publishing the patch upstream?

Average of ratings: -