Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
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 'string' => array( 35 'mode' => cache_store::MODE_APPLICATION, 36 'simplekeys' => true, 37 'simpledata' => true, 38 'staticacceleration' => true, 39 'staticaccelerationsize' => 30, 40 'canuselocalstore' => true, 41 ), 42 43 // Used to store cache of all available translations. 44 'langmenu' => array( 45 'mode' => cache_store::MODE_APPLICATION, 46 'simplekeys' => true, 47 'simpledata' => true, 48 'staticacceleration' => true, 49 'canuselocalstore' => 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 'simpledata' => true, // This is a read only class, so leaving references in place is safe. 62 'staticacceleration' => true, 63 'staticaccelerationsize' => 15 64 ), 65 66 // Event invalidation cache. 67 // This cache is used to manage event invalidation, its keys are the event names. 68 // Whenever something is invalidated it is both purged immediately and an event record created with the timestamp. 69 // When a new cache is initialised all timestamps are looked at and if past data is once more invalidated. 70 // Data guarantee is required in order to ensure invalidation always occurs. 71 // Persistence has been turned on as normally events are used for frequently used caches and this event invalidation 72 // cache will likely be used either lots or never. 73 'eventinvalidation' => array( 74 'mode' => cache_store::MODE_APPLICATION, 75 'staticacceleration' => true, 76 'requiredataguarantee' => true, 77 'simpledata' => true, 78 ), 79 80 // Cache for question definitions. This is used by the question_bank class. 81 // Users probably do not need to know about this cache. They will just call 82 // question_bank::load_question. 83 'questiondata' => array( 84 'mode' => cache_store::MODE_APPLICATION, 85 'simplekeys' => true, // The id of the question is used. 86 'requiredataguarantee' => false, 87 'datasource' => 'question_finder', 88 'datasourcefile' => 'question/engine/bank.php', 89 ), 90 91 // HTML Purifier cache 92 // This caches the html purifier cleaned text. This is done because the text is usually cleaned once for every user 93 // and context combo. Text caching handles caching for the combination, this cache is responsible for caching the 94 // cleaned text which is shareable. 95 'htmlpurifier' => array( 96 'mode' => cache_store::MODE_APPLICATION, 97 'canuselocalstore' => true, 98 ), 99 100 // Used to store data from the config + config_plugins table in the database. 101 // The key used is the component: 102 // - core for all core config settings 103 // - plugin component for all plugin settings. 104 // Persistence is used because normally several settings within a script. 105 'config' => array( 106 'mode' => cache_store::MODE_APPLICATION, 107 'staticacceleration' => true, 108 'simpledata' => true 109 ), 110 111 // Groupings belonging to a course. 112 // A simple cache designed to replace $GROUPLIB_CACHE->groupings. 113 // Items are organised by course id and are essentially course records. 114 'groupdata' => array( 115 'mode' => cache_store::MODE_APPLICATION, 116 'simplekeys' => true, // The course id the groupings exist for. 117 'simpledata' => true, // Array of stdClass objects containing only strings. 118 'staticacceleration' => true, // Likely there will be a couple of calls to this. 119 'staticaccelerationsize' => 2, // The original cache used 1, we've increased that to two. 120 ), 121 122 // Used to cache calendar subscriptions. 123 'calendar_subscriptions' => array( 124 'mode' => cache_store::MODE_APPLICATION, 125 'simplekeys' => true, 126 'simpledata' => true, 127 'staticacceleration' => true, 128 ), 129 130 // Cache the course categories where the user has any enrolment and all categories that this user can manage. 131 'calendar_categories' => array( 132 'mode' => cache_store::MODE_SESSION, 133 'simplekeys' => true, 134 'simpledata' => true, 135 'invalidationevents' => array( 136 'changesincoursecat', 137 'changesincategoryenrolment', 138 ), 139 'ttl' => 900, 140 ), 141 142 // Cache the capabilities list DB table. See get_all_capabilities in accesslib. 143 'capabilities' => array( 144 'mode' => cache_store::MODE_APPLICATION, 145 'simplekeys' => true, 146 'simpledata' => true, 147 'staticacceleration' => true, 148 'staticaccelerationsize' => 1, 149 'ttl' => 3600, // Just in case. 150 ), 151 152 // YUI Module cache. 153 // This stores the YUI module metadata for Shifted YUI modules in Moodle. 154 'yuimodules' => array( 155 'mode' => cache_store::MODE_APPLICATION, 156 ), 157 158 // Cache for the list of event observers. 159 'observers' => array( 160 'mode' => cache_store::MODE_APPLICATION, 161 'simplekeys' => true, 162 'simpledata' => true, 163 'staticacceleration' => true, 164 'staticaccelerationsize' => 2, 165 ), 166 167 // Cache used by the {@link core_plugin_manager} class. 168 // NOTE: this must be a shared cache. 169 'plugin_manager' => array( 170 'mode' => cache_store::MODE_APPLICATION, 171 'simplekeys' => true, 172 'simpledata' => true, 173 ), 174 175 // Used to store the full tree of course categories. 176 'coursecattree' => array( 177 'mode' => cache_store::MODE_APPLICATION, 178 'staticacceleration' => true, 179 'invalidationevents' => array( 180 'changesincoursecat', 181 ) 182 ), 183 // Used to store data for course categories visible to current user. Helps to browse list of categories. 184 'coursecat' => array( 185 'mode' => cache_store::MODE_SESSION, 186 'invalidationevents' => array( 187 'changesincoursecat', 188 'changesincourse', 189 ), 190 'ttl' => 600, 191 ), 192 // Used to store data for course categories visible to current user. Helps to browse list of categories. 193 'coursecatrecords' => array( 194 'mode' => cache_store::MODE_REQUEST, 195 'simplekeys' => true, 196 'invalidationevents' => array( 197 'changesincoursecat', 198 ), 199 ), 200 // Used to store state of sections in course (collapsed or not). 201 'coursesectionspreferences' => [ 202 'mode' => cache_store::MODE_REQUEST, 203 'simplekeys' => true, 204 'simpledata' => false, 205 'staticacceleration' => true, 206 ], 207 // Cache course contacts for the courses. 208 'coursecontacts' => array( 209 'mode' => cache_store::MODE_APPLICATION, 210 'staticacceleration' => true, 211 'simplekeys' => true, 212 'ttl' => 3600, 213 ), 214 // Course reactive state cache. 215 'courseeditorstate' => [ 216 'mode' => cache_store::MODE_SESSION, 217 'simplekeys' => true, 218 'simpledata' => true, 219 ], 220 // Used to store data for repositories to avoid repetitive DB queries within one request. 221 'repositories' => array( 222 'mode' => cache_store::MODE_REQUEST, 223 ), 224 // Used to store external badges. 225 'externalbadges' => array( 226 'mode' => cache_store::MODE_APPLICATION, 227 'simplekeys' => true, 228 'ttl' => 3600, 229 ), 230 // Accumulated information about course modules and sections used to print course view page (user-independent). 231 // Used in functions: 232 // - course_modinfo::build_course_section_cache() 233 // - course_modinfo::inner_build_course_cache() 234 // - get_array_of_activities() 235 // Reset/update in functions: 236 // - rebuild_course_cache() 237 // - course_modinfo::purge_module_cache() 238 // - course_modinfo::purge_section_cache() 239 // - remove_course_contents(). 240 'coursemodinfo' => array( 241 'mode' => cache_store::MODE_APPLICATION, 242 'simplekeys' => true, 243 'canuselocalstore' => true, 244 ), 245 // This is the session user selections cache. 246 // It's a special cache that is used to record user selections that should persist for the lifetime of the session. 247 // Things such as which categories the user has expanded can be stored here. 248 // It uses simple keys and simple data, please ensure all uses conform to those two constraints. 249 'userselections' => array( 250 'mode' => cache_store::MODE_SESSION, 251 'simplekeys' => true, 252 'simpledata' => true 253 ), 254 255 // Used to cache activity completion status. 256 'completion' => array( 257 'mode' => cache_store::MODE_APPLICATION, 258 'simplekeys' => true, 259 'simpledata' => true, 260 'ttl' => 3600, 261 'staticacceleration' => true, 262 'staticaccelerationsize' => 2, // Should be current course and site course. 263 ), 264 265 // Used to cache course completion status. 266 'coursecompletion' => array( 267 'mode' => cache_store::MODE_APPLICATION, 268 'simplekeys' => true, 269 'simpledata' => true, 270 'ttl' => 3600, 271 'staticacceleration' => true, 272 'staticaccelerationsize' => 30, // Will be users list of current courses in nav. 273 ), 274 275 // A simple cache that stores whether a user can expand a course in the navigation. 276 // The key is the course ID and the value will either be 1 or 0 (cast to bool). 277 // The cache isn't always up to date, it should only ever be used to save a costly call to 278 // can_access_course on the first page request a user makes. 279 'navigation_expandcourse' => array( 280 'mode' => cache_store::MODE_SESSION, 281 'simplekeys' => true, 282 'simpledata' => true 283 ), 284 285 // Caches suspended userids by course. 286 // The key is the courseid, the value is an array of user ids. 287 'suspended_userids' => array( 288 'mode' => cache_store::MODE_REQUEST, 289 'simplekeys' => true, 290 'simpledata' => true, 291 ), 292 293 // Cache system-wide role definitions. 294 'roledefs' => array( 295 'mode' => cache_store::MODE_APPLICATION, 296 'simplekeys' => true, 297 'simpledata' => true, 298 'staticacceleration' => true, 299 'staticaccelerationsize' => 30, 300 ), 301 302 // Caches plugins existing functions by function name and file. 303 // Set static acceleration size to 5 to load a few functions. 304 'plugin_functions' => array( 305 'mode' => cache_store::MODE_APPLICATION, 306 'simplekeys' => true, 307 'simpledata' => true, 308 'staticacceleration' => true, 309 'staticaccelerationsize' => 5 310 ), 311 312 // Caches data about tag collections and areas. 313 'tags' => array( 314 'mode' => cache_store::MODE_REQUEST, 315 'simplekeys' => true, 316 'staticacceleration' => true, 317 ), 318 319 // Grade categories. Stored at session level as invalidation is very aggressive. 320 'grade_categories' => array( 321 'mode' => cache_store::MODE_SESSION, 322 'simplekeys' => true, 323 'invalidationevents' => array( 324 'changesingradecategories', 325 ) 326 ), 327 328 // Store temporary tables information. 329 'temp_tables' => array( 330 'mode' => cache_store::MODE_REQUEST, 331 'simplekeys' => true, 332 'simpledata' => true 333 ), 334 335 // Caches tag index builder results. 336 'tagindexbuilder' => array( 337 'mode' => cache_store::MODE_SESSION, 338 'simplekeys' => true, 339 'simplevalues' => true, 340 'staticacceleration' => true, 341 'staticaccelerationsize' => 10, 342 'ttl' => 900, // 15 minutes. 343 'invalidationevents' => array( 344 'resettagindexbuilder', 345 ), 346 ), 347 348 // Caches contexts with insights. 349 'contextwithinsights' => array( 350 'mode' => cache_store::MODE_APPLICATION, 351 'simplekeys' => true, 352 'simpledata' => true, 353 'staticacceleration' => true, 354 'staticaccelerationsize' => 1 355 ), 356 357 // Caches message processors. 358 'message_processors_enabled' => array( 359 'mode' => cache_store::MODE_APPLICATION, 360 'simplekeys' => true, 361 'simpledata' => true, 362 'staticacceleration' => true, 363 'staticaccelerationsize' => 3 364 ), 365 366 // Caches the time of the last message in a conversation. 367 'message_time_last_message_between_users' => array( 368 'mode' => cache_store::MODE_APPLICATION, 369 'simplekeys' => true, // The conversation id is used. 370 'simplevalues' => true, 371 'datasource' => '\core_message\time_last_message_between_users', 372 ), 373 374 // Caches font awesome icons. 375 'fontawesomeiconmapping' => array( 376 'mode' => cache_store::MODE_APPLICATION, 377 'simplekeys' => true, 378 'simpledata' => true, 379 'staticacceleration' => true, 380 'staticaccelerationsize' => 1 381 ), 382 383 // Caches processed CSS. 384 'postprocessedcss' => array( 385 'mode' => cache_store::MODE_APPLICATION, 386 'simplekeys' => true, 387 'simpledata' => true, 388 'staticacceleration' => false, 389 ), 390 391 // Caches grouping and group ids of a user. 392 'user_group_groupings' => array( 393 'mode' => cache_store::MODE_APPLICATION, 394 'simplekeys' => true, 395 'simpledata' => true, 396 'staticacceleration' => true, 397 ), 398 399 // This is the user's pre sign-up session cache. 400 // This cache is used to record the user's pre sign-up data such as 401 // age of digital consent (minor) status, accepted policies, etc. 402 'presignup' => array( 403 'mode' => cache_store::MODE_SESSION, 404 'simplekeys' => true, 405 'simpledata' => true, 406 'ttl' => 1800 407 ), 408 409 // Caches the first time we analysed models' analysables. 410 'modelfirstanalyses' => array( 411 'mode' => cache_store::MODE_REQUEST, 412 'simplekeys' => true, 413 'simpledata' => true, 414 ), 415 416 // Cache the list of portfolio instances for the logged in user 417 // in the portfolio_add_button constructor to avoid loading the 418 // same data multiple times. 419 'portfolio_add_button_portfolio_instances' => [ 420 'mode' => cache_store::MODE_REQUEST, 421 'simplekeys' => true, 422 'staticacceleration' => true 423 ], 424 425 // Cache the user dates for courses set to relative dates mode. 426 'course_user_dates' => [ 427 'mode' => cache_store::MODE_REQUEST, 428 'simplekeys' => true, 429 'simpledata' => true, 430 'staticacceleration' => true 431 ], 432 433 // Information generated during the calculation of indicators. 434 'calculablesinfo' => [ 435 'mode' => cache_store::MODE_REQUEST, 436 'simplekeys' => false, 437 'simpledata' => false, 438 ], 439 440 // The list of content items (activities, resources and their subtypes) that can be added to a course for a user. 441 'user_course_content_items' => [ 442 'mode' => cache_store::MODE_REQUEST, 443 'simplekeys' => true, 444 ], 445 446 // The list of favourited content items (activities, resources and their subtypes) for a user. 447 'user_favourite_course_content_items' => [ 448 'mode' => cache_store::MODE_APPLICATION, 449 'simplekeys' => true, 450 ], 451 452 \core_course\local\service\content_item_service::RECOMMENDATION_CACHE => [ 453 'mode' => cache_store::MODE_APPLICATION, 454 'simplekeys' => true, 455 ], 456 457 // Caches contentbank extensions management. 458 'contentbank_enabled_extensions' => [ 459 'mode' => cache_store::MODE_APPLICATION, 460 'simplekeys' => true, 461 'simpledata' => true, 462 'staticacceleration' => true, 463 ], 464 'contentbank_context_extensions' => [ 465 'mode' => cache_store::MODE_REQUEST, 466 'simplekeys' => true, 467 'simpledata' => true, 468 'staticacceleration' => true, 469 ], 470 471 // Language strings for H5P content-type libraries. 472 // Key "{$libraryname}/{$language}"" contains translations for a given library and language. 473 // Key "$libraryname" has a list of all of the available languages for the library. 474 'h5p_content_type_translations' => [ 475 'mode' => cache_store::MODE_APPLICATION, 476 'simpledata' => true, 477 ], 478 479 // File cache for H5P Library files. 480 'h5p_library_files' => [ 481 'mode' => cache_store::MODE_APPLICATION, 482 'simplekeys' => true, 483 'canuselocalstore' => true 484 ], 485 486 // Cache the grade letters for faster retrival. 487 'grade_letters' => [ 488 'mode' => cache_store::MODE_REQUEST, 489 'simplekeys' => true, 490 'staticacceleration' => true, 491 'staticaccelerationsize' => 100 492 ], 493 494 // Cache for licenses. 495 'license' => [ 496 'mode' => cache_store::MODE_APPLICATION, 497 'simplekeys' => true, 498 'simpledata' => false, 499 ], 500 501 // Cache the grade setting for faster retrieval. 502 'gradesetting' => [ 503 'mode' => cache_store::MODE_REQUEST, 504 'simplekeys' => true, 505 'staticacceleration' => true, 506 'staticaccelerationsize' => 100 507 ], 508 509 // Course image cache. 510 'course_image' => [ 511 'mode' => cache_store::MODE_APPLICATION, 512 'simplekeys' => true, 513 'simpledata' => true, 514 'staticacceleration' => true, 515 'datasource' => '\core_course\cache\course_image', 516 ], 517 518 // Cache the course categories where the user has access the content bank. 519 'contentbank_allowed_categories' => [ 520 'mode' => cache_store::MODE_SESSION, 521 'simplekeys' => true, 522 'simpledata' => true, 523 'invalidationevents' => [ 524 'changesincoursecat', 525 'changesincategoryenrolment', 526 ], 527 ], 528 529 // Cache the courses where the user has access the content bank. 530 'contentbank_allowed_courses' => [ 531 'mode' => cache_store::MODE_SESSION, 532 'simplekeys' => true, 533 'simpledata' => true, 534 'invalidationevents' => [ 535 'changesincoursecat', 536 'changesincategoryenrolment', 537 'changesincourse', 538 ], 539 ], 540 541 // Users allowed reports according to audience. 542 'reportbuilder_allowed_reports' => [ 543 'mode' => cache_store::MODE_APPLICATION, 544 'simplekeys' => true, 545 'simpledata' => true, 546 'staticacceleration' => true, 547 'ttl' => 1800, 548 ], 549 );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body