Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-49489

coursecontacts regularly (unnecessarily?) purging

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.7.7, 2.8.5
    • 2.7.8, 2.8.6, 2.9
    • Caching
    • MOODLE_27_STABLE, MOODLE_28_STABLE
    • MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • patch-1
    • Easy
    • Hide
      1. Edit lib/coursecatlib.php, change CACHE_COURSE_CONTACTS_TTL to 1 second (so you don't have to keep waiting around)
      2. Create a new course
      3. On course/search.php search for that course so it shows up, should have no teachers listed
      4. Add a teacher
      5. Search again, the new teacher should be shown
      6. Add another teacher
      7. Search again, the new teacher should be shown
      8. Remove a teacher
      9. Search again, that teacher should disappear
      10. Remove the last teacher
      11. Search again, that teacher should disappear
      Show
      Edit lib/coursecatlib.php , change CACHE_COURSE_CONTACTS_TTL to 1 second (so you don't have to keep waiting around) Create a new course On course/search.php search for that course so it shows up, should have no teachers listed Add a teacher Search again, the new teacher should be shown Add another teacher Search again, the new teacher should be shown Remove a teacher Search again, that teacher should disappear Remove the last teacher Search again, that teacher should disappear

    Description

      We're still working out how best to configure all of the various cache definitions, and I've been looking at how frequently the various cache definitions are purged in a production environment.
      When a cache definition is on a memcached server shared with other definitions, purging one definition will purge the others as well, as Memcached can't segregate the various definitions.

      It seems the coursecontacts cache regularly purges itself, even though it seems to have fairly simple keys.

      The code (/lib/coursecatlib.php @ ~713-718 in 2.8.5) looks like this:

      $cacheddata = $cache->get_many(array_merge(array('basic'), array_keys($courses)));
      if (...) {
          $cache->purge();
          $cache->set('basic', ...
      }
      

      It seems the keys are all course ids (and 'basic') - so purging a list of course IDs would seem to make more sense, to prevent the purge?

      $cacheddata = $cache->get_many(array_merge(array('basic'), array_keys($courses)));
      if (...) {
          $cache->delete_many($DB->get_fieldset_select('course', 'id', ''));
          $cache->set('basic', ...
      }
      

      Attachments

        Issue Links

          Activity

            People

              moodle.com Moodle HQ
              skylarkelty Skylar Kelty
              John Okely John Okely
              Andrew Lyons Andrew Lyons
              Ankit Agarwal Ankit Agarwal
              Matteo Scaramuccia, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                11/May/15