[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/db/ -> caches.php (source)

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Core cache definitions.
  19   *
  20   * This file is part of Moodle's cache API, affectionately called MUC.
  21   * It contains the components that are requried in order to use caching.
  22   *
  23   * @package    core
  24   * @category   cache
  25   * @copyright  2012 Sam Hemelryk
  26   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  27   */
  28  
  29  $definitions = array(
  30  
  31      // Used to store processed lang files.
  32      // The keys used are the revision, lang and component of the string file.
  33      // The static acceleration size has been based upon student access of the site.
  34      // NOTE: this data may be safely stored in local caches on cluster nodes.
  35      'string' => array(
  36          'mode' => cache_store::MODE_APPLICATION,
  37          'simplekeys' => true,
  38          'simpledata' => true,
  39          'staticacceleration' => true,
  40          'staticaccelerationsize' => 30
  41      ),
  42  
  43      // Used to store cache of all available translations.
  44      // NOTE: this data may be safely stored in local caches on cluster nodes.
  45      'langmenu' => array(
  46          'mode' => cache_store::MODE_APPLICATION,
  47          'simplekeys' => true,
  48          'simpledata' => true,
  49          'staticacceleration' => true,
  50      ),
  51  
  52      // Used to store database meta information.
  53      // The database meta information includes information about tables and there columns.
  54      // Its keys are the table names.
  55      // When creating an instance of this definition you must provide the database family that is being used.
  56      'databasemeta' => array(
  57          'mode' => cache_store::MODE_APPLICATION,
  58          'requireidentifiers' => array(
  59              'dbfamily'
  60          ),
  61          'staticacceleration' => true,
  62          'staticaccelerationsize' => 15
  63      ),
  64  
  65      // Event invalidation cache.
  66      // This cache is used to manage event invalidation, its keys are the event names.
  67      // Whenever something is invalidated it is both purged immediately and an event record created with the timestamp.
  68      // When a new cache is initialised all timestamps are looked at and if past data is once more invalidated.
  69      // Data guarantee is required in order to ensure invalidation always occurs.
  70      // Persistence has been turned on as normally events are used for frequently used caches and this event invalidation
  71      // cache will likely be used either lots or never.
  72      'eventinvalidation' => array(
  73          'mode' => cache_store::MODE_APPLICATION,
  74          'staticacceleration' => true,
  75          'requiredataguarantee' => true,
  76          'simpledata' => true,
  77      ),
  78  
  79      // Cache for question definitions. This is used by the question_bank class.
  80      // Users probably do not need to know about this cache. They will just call
  81      // question_bank::load_question.
  82      'questiondata' => array(
  83          'mode' => cache_store::MODE_APPLICATION,
  84          'simplekeys' => true, // The id of the question is used.
  85          'requiredataguarantee' => false,
  86          'datasource' => 'question_finder',
  87          'datasourcefile' => 'question/engine/bank.php',
  88      ),
  89  
  90      // HTML Purifier cache
  91      // This caches the html purifier cleaned text. This is done because the text is usually cleaned once for every user
  92      // and context combo. Text caching handles caching for the combination, this cache is responsible for caching the
  93      // cleaned text which is shareable.
  94      // NOTE: this data may be safely stored in local caches on cluster nodes.
  95      'htmlpurifier' => array(
  96          'mode' => cache_store::MODE_APPLICATION,
  97      ),
  98  
  99      // Used to store data from the config + config_plugins table in the database.
 100      // The key used is the component:
 101      //   - core for all core config settings
 102      //   - plugin component for all plugin settings.
 103      // Persistence is used because normally several settings within a script.
 104      'config' => array(
 105          'mode' => cache_store::MODE_APPLICATION,
 106          'staticacceleration' => true,
 107          'simpledata' => true
 108      ),
 109  
 110      // Groupings belonging to a course.
 111      // A simple cache designed to replace $GROUPLIB_CACHE->groupings.
 112      // Items are organised by course id and are essentially course records.
 113      'groupdata' => array(
 114          'mode' => cache_store::MODE_APPLICATION,
 115          'simplekeys' => true, // The course id the groupings exist for.
 116          'simpledata' => true, // Array of stdClass objects containing only strings.
 117          'staticacceleration' => true, // Likely there will be a couple of calls to this.
 118          'staticaccelerationsize' => 2, // The original cache used 1, we've increased that to two.
 119      ),
 120  
 121      // Used to cache calendar subscriptions.
 122      'calendar_subscriptions' => array(
 123          'mode' => cache_store::MODE_APPLICATION,
 124          'simplekeys' => true,
 125          'simpledata' => true,
 126          'staticacceleration' => true,
 127      ),
 128  
 129      // YUI Module cache.
 130      // This stores the YUI module metadata for Shifted YUI modules in Moodle.
 131      'yuimodules' => array(
 132          'mode' => cache_store::MODE_APPLICATION,
 133      ),
 134  
 135      // Cache for the list of event observers.
 136      'observers' => array(
 137          'mode' => cache_store::MODE_APPLICATION,
 138          'simplekeys' => true,
 139          'simpledata' => true,
 140          'staticacceleration' => true,
 141          'staticaccelerationsize' => 2,
 142      ),
 143  
 144      // Cache used by the {@link core_plugin_manager} class.
 145      // NOTE: this must be a shared cache.
 146      'plugin_manager' => array(
 147          'mode' => cache_store::MODE_APPLICATION,
 148          'simplekeys' => true,
 149          'simpledata' => true,
 150      ),
 151  
 152      // Used to store the full tree of course categories.
 153      'coursecattree' => array(
 154          'mode' => cache_store::MODE_APPLICATION,
 155          'staticacceleration' => true,
 156          'invalidationevents' => array(
 157              'changesincoursecat',
 158          )
 159      ),
 160      // Used to store data for course categories visible to current user. Helps to browse list of categories.
 161      'coursecat' => array(
 162          'mode' => cache_store::MODE_SESSION,
 163          'invalidationevents' => array(
 164              'changesincoursecat',
 165              'changesincourse',
 166          ),
 167          'ttl' => 600,
 168      ),
 169      // Used to store data for course categories visible to current user. Helps to browse list of categories.
 170      'coursecatrecords' => array(
 171          'mode' => cache_store::MODE_REQUEST,
 172          'simplekeys' => true,
 173          'invalidationevents' => array(
 174              'changesincoursecat',
 175          ),
 176      ),
 177      // Cache course contacts for the courses.
 178      'coursecontacts' => array(
 179          'mode' => cache_store::MODE_APPLICATION,
 180          'staticacceleration' => true,
 181          'simplekeys' => true,
 182      ),
 183      // Used to store data for repositories to avoid repetitive DB queries within one request.
 184      'repositories' => array(
 185          'mode' => cache_store::MODE_REQUEST,
 186      ),
 187      // Used to store external badges.
 188      'externalbadges' => array(
 189          'mode' => cache_store::MODE_APPLICATION,
 190          'simplekeys' => true,
 191          'ttl' => 3600,
 192      ),
 193      // Accumulated information about course modules and sections used to print course view page (user-independed).
 194      // Used in function get_fast_modinfo(), reset in function rebuild_course_cache().
 195      'coursemodinfo' => array(
 196          'mode' => cache_store::MODE_APPLICATION,
 197          'simplekeys' => true,
 198      ),
 199      // This is the session user selections cache.
 200      // It's a special cache that is used to record user selections that should persist for the lifetime of the session.
 201      // Things such as which categories the user has expanded can be stored here.
 202      // It uses simple keys and simple data, please ensure all uses conform to those two constraints.
 203      'userselections' => array(
 204          'mode' => cache_store::MODE_SESSION,
 205          'simplekeys' => true,
 206          'simpledata' => true
 207      ),
 208      // Used to cache user grades for conditional availability purposes.
 209      'gradecondition' => array(
 210          'mode' => cache_store::MODE_APPLICATION,
 211          'staticacceleration' => true,
 212          'staticaccelerationsize' => 2, // Should not be required for more than one user at a time.
 213          'ttl' => 3600,
 214      ),
 215  
 216      // A simple cache that stores whether a user can expand a course in the navigation.
 217      // The key is the course ID and the value will either be 1 or 0 (cast to bool).
 218      // The cache isn't always up to date, it should only ever be used to save a costly call to
 219      // can_access_course on the first page request a user makes.
 220      'navigation_expandcourse' => array(
 221          'mode' => cache_store::MODE_SESSION,
 222          'simplekeys' => true,
 223          'simpledata' => true
 224      ),
 225  
 226      // Caches suspended userids by course.
 227      // The key is the courseid, the value is an array of user ids.
 228      'suspended_userids' => array(
 229          'mode' => cache_store::MODE_REQUEST,
 230          'simplekeys' => true,
 231          'simpledata' => true,
 232      ),
 233  );


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1