2 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 * Core cache definitions.
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.
25 * @copyright 2012 Sam Hemelryk
26 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
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.
36 'mode' => cache_store
::MODE_APPLICATION
,
39 'staticacceleration' => true,
40 'staticaccelerationsize' => 30
43 // Used to store cache of all available translations.
44 // NOTE: this data may be safely stored in local caches on cluster nodes.
46 'mode' => cache_store
::MODE_APPLICATION
,
49 'staticacceleration' => true,
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(
61 'staticacceleration' => true,
62 'staticaccelerationsize' => 15
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,
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',
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
,
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.
105 'mode' => cache_store
::MODE_APPLICATION
,
106 'staticacceleration' => true,
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.
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,
129 // Cache the capabilities list DB table. See get_all_capabilities in accesslib.
130 'capabilities' => array(
131 'mode' => cache_store
::MODE_APPLICATION
,
132 'simplekeys' => true,
133 'simpledata' => true,
134 'staticacceleration' => true,
135 'staticaccelerationsize' => 1,
136 'ttl' => 3600, // Just in case.
140 // This stores the YUI module metadata for Shifted YUI modules in Moodle.
141 'yuimodules' => array(
142 'mode' => cache_store
::MODE_APPLICATION
,
145 // Cache for the list of event observers.
146 'observers' => array(
147 'mode' => cache_store
::MODE_APPLICATION
,
148 'simplekeys' => true,
149 'simpledata' => true,
150 'staticacceleration' => true,
151 'staticaccelerationsize' => 2,
154 // Cache used by the {@link core_plugin_manager} class.
155 // NOTE: this must be a shared cache.
156 'plugin_manager' => array(
157 'mode' => cache_store
::MODE_APPLICATION
,
158 'simplekeys' => true,
159 'simpledata' => true,
162 // Used to store the full tree of course categories.
163 'coursecattree' => array(
164 'mode' => cache_store
::MODE_APPLICATION
,
165 'staticacceleration' => true,
166 'invalidationevents' => array(
167 'changesincoursecat',
170 // Used to store data for course categories visible to current user. Helps to browse list of categories.
171 'coursecat' => array(
172 'mode' => cache_store
::MODE_SESSION
,
173 'invalidationevents' => array(
174 'changesincoursecat',
179 // Used to store data for course categories visible to current user. Helps to browse list of categories.
180 'coursecatrecords' => array(
181 'mode' => cache_store
::MODE_REQUEST
,
182 'simplekeys' => true,
183 'invalidationevents' => array(
184 'changesincoursecat',
187 // Cache course contacts for the courses.
188 'coursecontacts' => array(
189 'mode' => cache_store
::MODE_APPLICATION
,
190 'staticacceleration' => true,
191 'simplekeys' => true,
194 // Used to store data for repositories to avoid repetitive DB queries within one request.
195 'repositories' => array(
196 'mode' => cache_store
::MODE_REQUEST
,
198 // Used to store external badges.
199 'externalbadges' => array(
200 'mode' => cache_store
::MODE_APPLICATION
,
201 'simplekeys' => true,
204 // Accumulated information about course modules and sections used to print course view page (user-independed).
205 // Used in function get_fast_modinfo(), reset in function rebuild_course_cache().
206 'coursemodinfo' => array(
207 'mode' => cache_store
::MODE_APPLICATION
,
208 'simplekeys' => true,
210 // This is the session user selections cache.
211 // It's a special cache that is used to record user selections that should persist for the lifetime of the session.
212 // Things such as which categories the user has expanded can be stored here.
213 // It uses simple keys and simple data, please ensure all uses conform to those two constraints.
214 'userselections' => array(
215 'mode' => cache_store
::MODE_SESSION
,
216 'simplekeys' => true,
220 // Used to cache activity completion status.
221 'completion' => array(
222 'mode' => cache_store
::MODE_APPLICATION
,
223 'simplekeys' => true,
224 'simpledata' => true,
226 'staticacceleration' => true,
227 'staticaccelerationsize' => 2, // Should be current course and site course.
230 // A simple cache that stores whether a user can expand a course in the navigation.
231 // The key is the course ID and the value will either be 1 or 0 (cast to bool).
232 // The cache isn't always up to date, it should only ever be used to save a costly call to
233 // can_access_course on the first page request a user makes.
234 'navigation_expandcourse' => array(
235 'mode' => cache_store
::MODE_SESSION
,
236 'simplekeys' => true,
240 // Caches suspended userids by course.
241 // The key is the courseid, the value is an array of user ids.
242 'suspended_userids' => array(
243 'mode' => cache_store
::MODE_REQUEST
,
244 'simplekeys' => true,
245 'simpledata' => true,
248 // Caches plugins existing functions by function name and file.
249 // Set static acceleration size to 5 to load a few functions.
250 'plugin_functions' => array(
251 'mode' => cache_store
::MODE_APPLICATION
,
252 'simplekeys' => true,
253 'simpledata' => true,
254 'staticacceleration' => true,
255 'staticaccelerationsize' => 5