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 persistent max 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,
40 'persistentmaxsize' => 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,
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(
62 'persistentmaxsize' => 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,
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 'persistent' => 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 'persistent' => true, // Likely there will be a couple of calls to this.
118 'persistmaxsize' => 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 'persistent' => true,
130 // This stores the YUI module metadata for Shifted YUI modules in Moodle.
131 'yuimodules' => array(
132 'mode' => cache_store::MODE_APPLICATION,
135 // Cache for the list of event observers.
136 'observers' => array(
137 'mode' => cache_store::MODE_APPLICATION,
138 'simplekeys' => true,
139 'simpledata' => true,
140 'persistent' => true,
141 'persistentmaxsize' => 2,
144 // Cache used by the {@link plugininfo_base} class.
145 'plugininfo_base' => array(
146 'mode' => cache_store::MODE_APPLICATION,
147 'simplekeys' => true,
148 'simpledata' => true,
149 'persistent' => true,
150 'persistentmaxsize' => 2,
153 // Cache used by the {@link plugininfo_mod} class.
154 'plugininfo_mod' => array(
155 'mode' => cache_store::MODE_APPLICATION,
156 'simplekeys' => true,
157 'simpledata' => true,
158 'persistent' => true,
159 'persistentmaxsize' => 1,
162 // Cache used by the {@link plugininfo_block} class.
163 'plugininfo_block' => array(
164 'mode' => cache_store::MODE_APPLICATION,
165 'simplekeys' => true,
166 'simpledata' => true,
167 'persistent' => true,
168 'persistentmaxsize' => 1,
171 // Cache used by the {@link plugininfo_filter} class.
172 'plugininfo_filter' => array(
173 'mode' => cache_store::MODE_APPLICATION,
174 'simplekeys' => true,
175 'simpledata' => true,
176 'persistent' => true,
177 'persistentmaxsize' => 1,
180 // Cache used by the {@link plugininfo_repository} class.
181 'plugininfo_repository' => array(
182 'mode' => cache_store::MODE_APPLICATION,
183 'simplekeys' => true,
184 'simpledata' => true,
185 'persistent' => true,
186 'persistentmaxsize' => 1,
189 // Cache used by the {@link plugininfo_portfolio} class.
190 'plugininfo_portfolio' => array(
191 'mode' => cache_store::MODE_APPLICATION,
192 'simplekeys' => true,
193 'simpledata' => true,
194 'persistent' => true,
195 'persistentmaxsize' => 1,
198 // Used to store the full tree of course categories
199 'coursecattree' => array(
200 'mode' => cache_store::MODE_APPLICATION,
201 'persistent' => true,
202 'invalidationevents' => array(
203 'changesincoursecat',
206 // Used to store data for course categories visible to current user. Helps to browse list of categories
207 'coursecat' => array(
208 'mode' => cache_store::MODE_SESSION,
209 'persistent' => true,
210 'invalidationevents' => array(
211 'changesincoursecat',
216 // Used to store data for course categories visible to current user. Helps to browse list of categories
217 'coursecatrecords' => array(
218 'mode' => cache_store::MODE_REQUEST,
219 'simplekeys' => true,
220 'persistent' => true,
221 'invalidationevents' => array(
222 'changesincoursecat',
225 // Cache course contacts for the courses
226 'coursecontacts' => array(
227 'mode' => cache_store::MODE_APPLICATION,
228 'persistent' => true,
229 'simplekeys' => true,
231 // Used to store data for repositories to avoid repetitive DB queries within one request
232 'repositories' => array(
233 'mode' => cache_store::MODE_REQUEST,
234 'persistent' => true,