Details

    • Testing Instructions:
      Hide

      Developer required for these:

      1. Install Redis and the Redis PHP extension and configure it.
      2. Restart your web server.
      3. Browse to Admin > Plugins > Caching > Stores > Redis
      4. Set a redis test server (127.0.0.1:6379) The port tests that the port splitting is working.
      5. Browse to Admin > Plugins > Caching > Test performance
      6. Make sure that Redis is being tested.
      7. Browse to Admin > Plugins > Caching > Configuration
      8. Create a Redis instance
      9. Map it to the string and config caches
      10. Browse the site and make sure everything is OK.

      To ensure Redis is working in the testing space;
      in config.php, set:

      define('TEST_CACHESTORE_REDIS_TESTSERVERS', '127.0.0.1');
      

      Verify Redis testing is passing by itself with (.)'s and aren't skipped.

      vendor/bin/phpunit cache/stores/redis/tests/redis_test.php
      

      WARNING: You may need to merge MDL-56273 if it's not already been merged. Otherwise tests will fail as not all caches will have been cleared.

      Add the following to config.php to use redis as the default application store for testing;

      define('TEST_CACHE_USING_APPLICATION_STORE' , 'redis');
      

      Run PHPUnit to verify that all the tests pass with a different store set.

      vendor/bin/phpunit
      

      Show
      Developer required for these: Install Redis and the Redis PHP extension and configure it. Restart your web server. Browse to Admin > Plugins > Caching > Stores > Redis Set a redis test server (127.0.0.1:6379) The port tests that the port splitting is working. Browse to Admin > Plugins > Caching > Test performance Make sure that Redis is being tested. Browse to Admin > Plugins > Caching > Configuration Create a Redis instance Map it to the string and config caches Browse the site and make sure everything is OK. To ensure Redis is working in the testing space; in config.php, set: define('TEST_CACHESTORE_REDIS_TESTSERVERS', '127.0.0.1'); Verify Redis testing is passing by itself with (.)'s and aren't skipped. vendor/bin/phpunit cache/stores/redis/tests/redis_test.php WARNING: You may need to merge MDL-56273 if it's not already been merged. Otherwise tests will fail as not all caches will have been cleared. Add the following to config.php to use redis as the default application store for testing; define('TEST_CACHE_USING_APPLICATION_STORE' , 'redis'); Run PHPUnit to verify that all the tests pass with a different store set. vendor/bin/phpunit
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull Master Branch:

      Description

      I've created a Redis cache store plugin that is available through http://github.com/samhemelryk/moodle-cachestore_redis.git
      I'd like to purpose its inclusion into Moodle core.
      Please if you would like to see it included within Moodle by default vote for this issue.
      Otherwise if you have thoughts to share please comment.
      Many thanks
      Sam

      Original git details;
      Repository: git://github.com/samhemelryk/moodle.git
      Branch: 48468-29
      Pull Diff: http://mdl.icodedthat.com/48468-29


      Moodlerooms has a more featureful version available at; https://github.com/durana/moodle-cachestore_redis

      Some things about where Redis is at compared with Memcache(d).

      PHP7 was released on December 13 2015.

      Plugin Last Released PHP 7 Support Session locking plugin for Moodle Purge single cache Persistent Data Locking URL
      Memcache 2013-04-07 (as beta) No No No No No https://pecl.php.net/package/memcache
      Memcached 2014-04-01 No Yes No No No https://pecl.php.net/package/memcached
      Redis 2016-06-10 Yes Yes Yes Yes Yes https://pecl.php.net/package/redis

      Memcache and Memcached seem to not be supporting PHP7 quickly. They also lack the features that we want from a cache store. Redis is an alternative that has the features required.

      Redis is only really for multi-node complex setups.
      Filesystem cache has problems when using shared storage due to things like NFS attribute caching (15seconds).
      Redis is in the top 3% of voted items to be included as a feature in core.

      Core needs to be able to provide support for single and multi-node setups without needing to resort to installing a number of plugins. Memcache offered that capability in the past but it's not able to as we move more and more to PHP7. HQ sites have moved to PHP7, but back to filesystem sessions because of issues with alpha memcache plugins they were trying to make work for sessions.

      Redis would provide a much simpler list of supported features as it does sessions and caches in one go compared with the Memcache(d) alternatives. It's features are better and it's support is better.

      Redis has recently had a session handler accepted into core. And due to the popularity of that it's been accepted to be backported to support branches MDL-55602. Non-core users have also reported porting it as far back as 2.7. It is popular and with session already supported there is an infrastructure requirement for testing Redis and a cachestore using the same infrastructure does not add any further burden.

      The purging issue with memcache(d) has been outstanding for 2 years, MDL-45375. It even suggests that a better solution may be to attempt to implement Redis rather than trying to solve the purging issues that are inherit in the design of memcache.

      I would consider removing both of the memcache(d) plugins in favour of Redis to keep the number of core plugins down.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                29 Vote for this issue
                Watchers:
                42 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/Dec/16