2012-09-10 15:28:32 +12:00
|
|
|
<?php
|
2012-09-18 13:34:56 +12:00
|
|
|
// This file is part of Moodle - http://moodle.org/
|
|
|
|
//
|
|
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Core cache definitions.
|
|
|
|
*
|
|
|
|
* This file is part of Moodle's cache API, affectionately called MUC.
|
|
|
|
* It contains the components that are requried in order to use caching.
|
|
|
|
*
|
|
|
|
* @package core
|
|
|
|
* @category cache
|
|
|
|
* @copyright 2012 Sam Hemelryk
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
|
*/
|
2012-09-10 15:28:32 +12:00
|
|
|
|
|
|
|
$definitions = array(
|
2012-10-17 17:25:04 +08:00
|
|
|
|
2012-09-18 14:37:16 +12:00
|
|
|
// Used to store processed lang files.
|
2013-08-04 00:01:58 +02:00
|
|
|
// The keys used are the revision, lang and component of the string file.
|
2013-09-17 13:39:49 +12:00
|
|
|
// The static acceleration size has been based upon student access of the site.
|
2013-08-04 00:01:58 +02:00
|
|
|
// NOTE: this data may be safely stored in local caches on cluster nodes.
|
2012-09-10 15:28:32 +12:00
|
|
|
'string' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
2012-11-02 14:43:26 +13:00
|
|
|
'simplekeys' => true,
|
2012-11-05 10:28:07 +13:00
|
|
|
'simpledata' => true,
|
2013-09-17 11:56:15 +12:00
|
|
|
'staticacceleration' => true,
|
|
|
|
'staticaccelerationsize' => 30
|
2012-09-10 15:28:32 +12:00
|
|
|
),
|
2012-10-17 17:25:04 +08:00
|
|
|
|
2013-08-04 00:01:58 +02:00
|
|
|
// Used to store cache of all available translations.
|
|
|
|
// NOTE: this data may be safely stored in local caches on cluster nodes.
|
|
|
|
'langmenu' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
|
|
|
'simplekeys' => true,
|
|
|
|
'simpledata' => true,
|
2013-09-17 13:39:49 +12:00
|
|
|
'staticacceleration' => true,
|
2013-08-04 00:01:58 +02:00
|
|
|
),
|
|
|
|
|
2012-09-18 14:37:16 +12:00
|
|
|
// Used to store database meta information.
|
2012-11-02 14:43:26 +13:00
|
|
|
// The database meta information includes information about tables and there columns.
|
|
|
|
// Its keys are the table names.
|
|
|
|
// When creating an instance of this definition you must provide the database family that is being used.
|
2012-09-10 15:28:32 +12:00
|
|
|
'databasemeta' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
|
|
|
'requireidentifiers' => array(
|
|
|
|
'dbfamily'
|
|
|
|
),
|
2013-09-17 11:56:15 +12:00
|
|
|
'staticacceleration' => true,
|
|
|
|
'staticaccelerationsize' => 15
|
2012-09-10 15:28:32 +12:00
|
|
|
),
|
2012-10-17 17:25:04 +08:00
|
|
|
|
2012-09-18 14:37:16 +12:00
|
|
|
// Event invalidation cache.
|
2012-11-02 14:43:26 +13:00
|
|
|
// This cache is used to manage event invalidation, its keys are the event names.
|
|
|
|
// Whenever something is invalidated it is both purged immediately and an event record created with the timestamp.
|
|
|
|
// When a new cache is initialised all timestamps are looked at and if past data is once more invalidated.
|
|
|
|
// Data guarantee is required in order to ensure invalidation always occurs.
|
|
|
|
// Persistence has been turned on as normally events are used for frequently used caches and this event invalidation
|
|
|
|
// cache will likely be used either lots or never.
|
2012-09-10 15:28:32 +12:00
|
|
|
'eventinvalidation' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
2013-09-17 11:56:15 +12:00
|
|
|
'staticacceleration' => true,
|
2012-11-05 10:28:07 +13:00
|
|
|
'requiredataguarantee' => true,
|
|
|
|
'simpledata' => true,
|
2012-10-17 17:25:04 +08:00
|
|
|
),
|
|
|
|
|
|
|
|
// Cache for question definitions. This is used by the question_bank class.
|
|
|
|
// Users probably do not need to know about this cache. They will just call
|
|
|
|
// question_bank::load_question.
|
|
|
|
'questiondata' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
2012-11-02 14:43:26 +13:00
|
|
|
'simplekeys' => true, // The id of the question is used.
|
2012-10-17 17:25:04 +08:00
|
|
|
'requiredataguarantee' => false,
|
|
|
|
'datasource' => 'question_finder',
|
|
|
|
'datasourcefile' => 'question/engine/bank.php',
|
|
|
|
),
|
2012-11-05 09:36:54 +13:00
|
|
|
|
|
|
|
// HTML Purifier cache
|
|
|
|
// This caches the html purifier cleaned text. This is done because the text is usually cleaned once for every user
|
2013-05-06 10:35:17 +12:00
|
|
|
// and context combo. Text caching handles caching for the combination, this cache is responsible for caching the
|
2012-11-05 09:36:54 +13:00
|
|
|
// cleaned text which is shareable.
|
2013-08-03 10:48:15 +02:00
|
|
|
// NOTE: this data may be safely stored in local caches on cluster nodes.
|
2012-11-05 09:36:54 +13:00
|
|
|
'htmlpurifier' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
2013-01-16 01:08:26 +01:00
|
|
|
),
|
|
|
|
|
2012-08-14 11:40:28 +12:00
|
|
|
// Used to store data from the config + config_plugins table in the database.
|
|
|
|
// The key used is the component:
|
|
|
|
// - core for all core config settings
|
|
|
|
// - plugin component for all plugin settings.
|
|
|
|
// Persistence is used because normally several settings within a script.
|
|
|
|
'config' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
2013-09-17 11:56:15 +12:00
|
|
|
'staticacceleration' => true,
|
2012-08-14 11:40:28 +12:00
|
|
|
'simpledata' => true
|
|
|
|
),
|
2012-12-21 09:43:31 +13:00
|
|
|
|
|
|
|
// Groupings belonging to a course.
|
|
|
|
// A simple cache designed to replace $GROUPLIB_CACHE->groupings.
|
|
|
|
// Items are organised by course id and are essentially course records.
|
|
|
|
'groupdata' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
|
|
|
'simplekeys' => true, // The course id the groupings exist for.
|
|
|
|
'simpledata' => true, // Array of stdClass objects containing only strings.
|
2013-09-17 11:56:15 +12:00
|
|
|
'staticacceleration' => true, // Likely there will be a couple of calls to this.
|
2013-09-17 13:39:49 +12:00
|
|
|
'staticaccelerationsize' => 2, // The original cache used 1, we've increased that to two.
|
2013-01-22 16:35:48 +13:00
|
|
|
),
|
2013-01-21 11:05:56 +01:00
|
|
|
|
|
|
|
// Used to cache calendar subscriptions.
|
2013-01-17 11:11:15 +08:00
|
|
|
'calendar_subscriptions' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
2013-01-22 16:35:03 +13:00
|
|
|
'simplekeys' => true,
|
|
|
|
'simpledata' => true,
|
2013-09-17 11:56:15 +12:00
|
|
|
'staticacceleration' => true,
|
2013-03-15 15:33:59 +00:00
|
|
|
),
|
|
|
|
|
|
|
|
// YUI Module cache.
|
|
|
|
// This stores the YUI module metadata for Shifted YUI modules in Moodle.
|
|
|
|
'yuimodules' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
|
|
|
),
|
2013-03-20 14:08:55 +08:00
|
|
|
|
2013-06-16 15:33:47 +02:00
|
|
|
// Cache for the list of event observers.
|
|
|
|
'observers' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
|
|
|
'simplekeys' => true,
|
|
|
|
'simpledata' => true,
|
2013-09-17 11:56:15 +12:00
|
|
|
'staticacceleration' => true,
|
|
|
|
'staticaccelerationsize' => 2,
|
2013-06-16 15:33:47 +02:00
|
|
|
),
|
|
|
|
|
2013-10-04 22:40:44 +02:00
|
|
|
// Cache used by the {@link core_plugin_manager} class.
|
2013-09-14 23:57:21 +02:00
|
|
|
// NOTE: this must be a shared cache.
|
|
|
|
'plugin_manager' => array(
|
2013-02-12 18:24:56 +01:00
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
|
|
|
'simplekeys' => true,
|
|
|
|
'simpledata' => true,
|
2013-08-01 18:13:58 +12:00
|
|
|
),
|
|
|
|
|
|
|
|
// Used to store the full tree of course categories.
|
2013-02-28 12:29:15 +11:00
|
|
|
'coursecattree' => array(
|
2013-02-21 09:57:40 +11:00
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
2013-09-17 11:56:15 +12:00
|
|
|
'staticacceleration' => true,
|
2013-02-28 12:29:15 +11:00
|
|
|
'invalidationevents' => array(
|
|
|
|
'changesincoursecat',
|
|
|
|
)
|
|
|
|
),
|
2013-08-01 18:13:58 +12:00
|
|
|
// Used to store data for course categories visible to current user. Helps to browse list of categories.
|
2013-02-28 12:29:15 +11:00
|
|
|
'coursecat' => array(
|
|
|
|
'mode' => cache_store::MODE_SESSION,
|
|
|
|
'invalidationevents' => array(
|
|
|
|
'changesincoursecat',
|
|
|
|
'changesincourse',
|
|
|
|
),
|
|
|
|
'ttl' => 600,
|
|
|
|
),
|
2013-08-01 18:13:58 +12:00
|
|
|
// Used to store data for course categories visible to current user. Helps to browse list of categories.
|
2013-02-28 12:29:15 +11:00
|
|
|
'coursecatrecords' => array(
|
|
|
|
'mode' => cache_store::MODE_REQUEST,
|
2013-02-21 09:57:40 +11:00
|
|
|
'simplekeys' => true,
|
2013-02-28 12:29:15 +11:00
|
|
|
'invalidationevents' => array(
|
|
|
|
'changesincoursecat',
|
|
|
|
),
|
2013-02-21 09:57:40 +11:00
|
|
|
),
|
2013-08-01 18:13:58 +12:00
|
|
|
// Cache course contacts for the courses.
|
2013-05-06 15:16:48 +10:00
|
|
|
'coursecontacts' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
2013-09-17 11:56:15 +12:00
|
|
|
'staticacceleration' => true,
|
2013-05-06 15:16:48 +10:00
|
|
|
'simplekeys' => true,
|
|
|
|
),
|
2013-08-01 18:13:58 +12:00
|
|
|
// Used to store data for repositories to avoid repetitive DB queries within one request.
|
2013-04-03 14:03:24 +11:00
|
|
|
'repositories' => array(
|
|
|
|
'mode' => cache_store::MODE_REQUEST,
|
|
|
|
),
|
2013-09-02 13:37:15 +08:00
|
|
|
// Used to store external badges.
|
|
|
|
'externalbadges' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
|
|
|
'simplekeys' => true,
|
|
|
|
'ttl' => 3600,
|
|
|
|
),
|
2013-08-27 16:58:58 +10:00
|
|
|
// Accumulated information about course modules and sections used to print course view page (user-independed).
|
|
|
|
// Used in function get_fast_modinfo(), reset in function rebuild_course_cache().
|
|
|
|
'coursemodinfo' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
|
|
|
'simplekeys' => true,
|
|
|
|
),
|
2013-10-17 12:11:31 +13:00
|
|
|
// This is the session user selections cache.
|
|
|
|
// It's a special cache that is used to record user selections that should persist for the lifetime of the session.
|
|
|
|
// Things such as which categories the user has expanded can be stored here.
|
|
|
|
// It uses simple keys and simple data, please ensure all uses conform to those two constraints.
|
|
|
|
'userselections' => array(
|
|
|
|
'mode' => cache_store::MODE_SESSION,
|
|
|
|
'simplekeys' => true,
|
|
|
|
'simpledata' => true
|
|
|
|
),
|
2013-10-29 12:22:59 +11:00
|
|
|
// Used to cache user grades for conditional availability purposes.
|
|
|
|
'gradecondition' => array(
|
|
|
|
'mode' => cache_store::MODE_APPLICATION,
|
|
|
|
'staticacceleration' => true,
|
|
|
|
'staticaccelerationsize' => 2, // Should not be required for more than one user at a time.
|
|
|
|
'ttl' => 3600,
|
|
|
|
),
|
2014-03-21 13:08:35 +13:00
|
|
|
|
|
|
|
// A simple cache that stores whether a user can expand a course in the navigation.
|
|
|
|
// The key is the course ID and the value will either be 1 or 0 (cast to bool).
|
|
|
|
// The cache isn't always up to date, it should only ever be used to save a costly call to
|
|
|
|
// can_access_course on the first page request a user makes.
|
|
|
|
'navigation_expandcourse' => array(
|
|
|
|
'mode' => cache_store::MODE_SESSION,
|
|
|
|
'simplekeys' => true,
|
|
|
|
'simpledata' => true
|
2014-06-25 17:33:10 +09:30
|
|
|
),
|
|
|
|
|
2014-07-08 09:52:41 +12:00
|
|
|
// Caches suspended userids by course.
|
|
|
|
// The key is the courseid, the value is an array of user ids.
|
|
|
|
'suspended_userids' => array(
|
2014-06-25 17:33:10 +09:30
|
|
|
'mode' => cache_store::MODE_REQUEST,
|
|
|
|
'simplekeys' => true,
|
|
|
|
'simpledata' => true,
|
|
|
|
),
|
2012-09-10 15:28:32 +12:00
|
|
|
);
|