MDL-38777 JavaScript: Remove YUI cache persistence
[moodle.git] / lib / db / caches.php
CommitLineData
d6a1f63b 1<?php
167ad91e
SH
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 */
d6a1f63b
SH
28
29$definitions = array(
a560d636 30
170f821b 31 // Used to store processed lang files.
47834bcd 32 // The keys used are the component of the string file.
d6a1f63b
SH
33 'string' => array(
34 'mode' => cache_store::MODE_APPLICATION,
47834bcd 35 'simplekeys' => true,
2e1e266c 36 'simpledata' => true,
d6a1f63b
SH
37 'persistent' => true,
38 'persistentmaxsize' => 3
39 ),
a560d636 40
170f821b 41 // Used to store database meta information.
47834bcd
SH
42 // The database meta information includes information about tables and there columns.
43 // Its keys are the table names.
44 // When creating an instance of this definition you must provide the database family that is being used.
d6a1f63b
SH
45 'databasemeta' => array(
46 'mode' => cache_store::MODE_APPLICATION,
47 'requireidentifiers' => array(
48 'dbfamily'
49 ),
50 'persistent' => true,
51 'persistentmaxsize' => 2
52 ),
a560d636 53
170f821b 54 // Event invalidation cache.
47834bcd
SH
55 // This cache is used to manage event invalidation, its keys are the event names.
56 // Whenever something is invalidated it is both purged immediately and an event record created with the timestamp.
57 // When a new cache is initialised all timestamps are looked at and if past data is once more invalidated.
58 // Data guarantee is required in order to ensure invalidation always occurs.
59 // Persistence has been turned on as normally events are used for frequently used caches and this event invalidation
60 // cache will likely be used either lots or never.
d6a1f63b
SH
61 'eventinvalidation' => array(
62 'mode' => cache_store::MODE_APPLICATION,
63 'persistent' => true,
2e1e266c
SH
64 'requiredataguarantee' => true,
65 'simpledata' => true,
a560d636
TH
66 ),
67
68 // Cache for question definitions. This is used by the question_bank class.
69 // Users probably do not need to know about this cache. They will just call
70 // question_bank::load_question.
71 'questiondata' => array(
72 'mode' => cache_store::MODE_APPLICATION,
47834bcd 73 'simplekeys' => true, // The id of the question is used.
a560d636
TH
74 'requiredataguarantee' => false,
75 'datasource' => 'question_finder',
76 'datasourcefile' => 'question/engine/bank.php',
77 ),
e85c56cc
SH
78
79 // HTML Purifier cache
80 // This caches the html purifier cleaned text. This is done because the text is usually cleaned once for every user
81 // and context combo. Text caching handles caching for the combonation, this cache is responsible for caching the
82 // cleaned text which is shareable.
83 'htmlpurifier' => array(
84 'mode' => cache_store::MODE_APPLICATION,
a9135060
EL
85 ),
86
007bfe8b
SH
87 // Used to store data from the config + config_plugins table in the database.
88 // The key used is the component:
89 // - core for all core config settings
90 // - plugin component for all plugin settings.
91 // Persistence is used because normally several settings within a script.
92 'config' => array(
93 'mode' => cache_store::MODE_APPLICATION,
94 'persistent' => true,
95 'simpledata' => true
96 ),
e17dbeeb
SH
97
98 // Groupings belonging to a course.
99 // A simple cache designed to replace $GROUPLIB_CACHE->groupings.
100 // Items are organised by course id and are essentially course records.
101 'groupdata' => array(
102 'mode' => cache_store::MODE_APPLICATION,
103 'simplekeys' => true, // The course id the groupings exist for.
104 'simpledata' => true, // Array of stdClass objects containing only strings.
34424d4c 105 'persistent' => true, // Likely there will be a couple of calls to this.
e17dbeeb 106 'persistmaxsize' => 2, // The original cache used 1, we've increased that to two.
59573bb4 107 ),
dbaaeb93
DM
108
109 // Used to cache calendar subscriptions.
e73b527c
AA
110 'calendar_subscriptions' => array(
111 'mode' => cache_store::MODE_APPLICATION,
36546841
SH
112 'simplekeys' => true,
113 'simpledata' => true,
e73b527c 114 'persistent' => true,
aa135c4d
ARN
115 ),
116
117 // YUI Module cache.
118 // This stores the YUI module metadata for Shifted YUI modules in Moodle.
119 'yuimodules' => array(
120 'mode' => cache_store::MODE_APPLICATION,
aa135c4d 121 ),
c2eb74df 122
07622d7d
DM
123 // Cache for the list of known plugin and subplugin types - {@see get_plugin_types()}.
124 // Contains two arrays of (string)pluginname => (string)location. The first array with
125 // the key 0 contains locations relative to $CFG->dirroot. The second array with the
126 // key 1 contains absolute paths.
127 'plugintypes' => array(
128 'mode' => cache_store::MODE_APPLICATION,
129 'simplekeys' => true, // 0 or 1 depending on the requested location type.
130 'simpledata' => true, // Array of strings.
131 'persistent' => true, // Likely there will be a couple of calls to this.
132 'persistmaxsize' => 2, // Both arrays should stay loaded in memory.
133 ),
134
dbaaeb93
DM
135 // Cache for the list of installed plugins - {@see get_plugin_list()}.
136 // The key consists of the plugin type string (e.g. mod, block, enrol etc).
137 // The value is an associative array of plugin name => plugin location.
138 'pluginlist' => array(
139 'mode' => cache_store::MODE_APPLICATION,
140 'simplekeys' => true,
141 'simpledata' => true,
142 'persistent' => true,
143 'persistentmaxsize' => 2,
144 ),
ad3ed98b
DM
145
146 // Cache used by the {@link plugininfo_base} class.
147 'plugininfo_base' => array(
148 'mode' => cache_store::MODE_APPLICATION,
149 'simplekeys' => true,
150 'simpledata' => true,
151 'persistent' => true,
152 'persistentmaxsize' => 2,
153 ),
154
155 // Cache used by the {@link plugininfo_mod} class.
156 'plugininfo_mod' => array(
157 'mode' => cache_store::MODE_APPLICATION,
158 'simplekeys' => true,
159 'simpledata' => true,
160 'persistent' => true,
161 'persistentmaxsize' => 1,
162 ),
163
164 // Cache used by the {@link plugininfo_block} class.
165 'plugininfo_block' => array(
166 'mode' => cache_store::MODE_APPLICATION,
167 'simplekeys' => true,
168 'simpledata' => true,
169 'persistent' => true,
170 'persistentmaxsize' => 1,
171 ),
172
173 // Cache used by the {@link plugininfo_filter} class.
174 'plugininfo_filter' => array(
175 'mode' => cache_store::MODE_APPLICATION,
176 'simplekeys' => true,
177 'simpledata' => true,
178 'persistent' => true,
179 'persistentmaxsize' => 1,
180 ),
181
182 // Cache used by the {@link plugininfo_repository} class.
183 'plugininfo_repository' => array(
184 'mode' => cache_store::MODE_APPLICATION,
185 'simplekeys' => true,
186 'simpledata' => true,
187 'persistent' => true,
188 'persistentmaxsize' => 1,
189 ),
190
191 // Cache used by the {@link plugininfo_portfolio} class.
192 'plugininfo_portfolio' => array(
193 'mode' => cache_store::MODE_APPLICATION,
194 'simplekeys' => true,
195 'simpledata' => true,
196 'persistent' => true,
197 'persistentmaxsize' => 1,
198 ),
199
eabbfa82
MG
200 // Used to store the full tree of course categories
201 'coursecattree' => array(
b33389d2 202 'mode' => cache_store::MODE_APPLICATION,
eabbfa82
MG
203 'persistent' => true,
204 'invalidationevents' => array(
205 'changesincoursecat',
206 )
207 ),
208 // Used to store data for course categories visible to current user. Helps to browse list of categories
209 'coursecat' => array(
210 'mode' => cache_store::MODE_SESSION,
211 'persistent' => true,
212 'invalidationevents' => array(
213 'changesincoursecat',
214 'changesincourse',
215 ),
216 'ttl' => 600,
217 ),
218 // Used to store data for course categories visible to current user. Helps to browse list of categories
219 'coursecatrecords' => array(
220 'mode' => cache_store::MODE_REQUEST,
b33389d2 221 'simplekeys' => true,
15d50fff 222 'persistent' => true,
eabbfa82
MG
223 'invalidationevents' => array(
224 'changesincoursecat',
225 ),
b33389d2 226 ),
118ca9e9
MG
227 // Used to store data for repositories to avoid repetitive DB queries within one request
228 'repositories' => array(
229 'mode' => cache_store::MODE_REQUEST,
230 'persistent' => true,
231 ),
d6a1f63b 232);