Mini Shell
<?php
// 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/>.
/**
* Theme LearnR - Cache definitions.
*
* @package theme_learnr
* @copyright 2022 Alexander Bias, lern.link GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$definitions = array(
// This cache stores the flavours which apply to a particular user in his user session.
// It is there to avoid that the flavour which applies has to be calculated on every page load.
// The cache key is the page category ID (and 0 for all non-category pages).
// The cache value is the full flavour object.
//
// This is a session cache by purpose. It isn't an application cache as it contains user-specific data.
// And it isn't a user preference as we have to store multiple values per user (one value per page category ID).
// A benefit of the session cache is that it is invalidated on each login which means that, if the cache misbehaves for any
// reason, everything should be fine again after logging out and in again.
//
// Beyond that, the cache has to invalidated based on several events:
// 1. When a flavour is created / edited / deleted
// -- (this is realized in flavours/edit.php where cache_helper::purge_by_event is called with an invalidationevent
// -- which purges the cache for all users).
// 2. When the flavours are re-sorted
// -- (this is realized in flavours/overview.php where cache_helper::purge_by_event is called with an invalidationevent
// -- which purges the cache for all users).
// 3. When a cohort is deleted
// -- (this is realized with an event observer where cache_helper::purge_by_event is called with an invalidationevent
// -- which purges the cache for all users).
// 4. When a user is added to / removed from a category
// -- (this is realized with an event observer which sets a user preference flag, followed by a check in
// -- theme_learnr_get_flavour_which_applies() which purges the cache for the affected user).
'flavours' => array(
'mode' => cache_store::MODE_SESSION,
'simplekeys' => true,
'simpledata' => false,
'invalidationevents' => array(
'theme_learnr_flavours_resorted',
'theme_learnr_flavours_created',
'theme_learnr_flavours_edited',
'theme_learnr_flavours_deleted',
'theme_learnr_cohort_deleted'
)
),
// This cache stores the FontAwesome files (which are uploaded in the LearnR settings)
// to avoid that the files have to be read from the filearea on every page load.
'fontawesome' => array(
'mode' => cache_store::MODE_APPLICATION,
'simplekeys' => true,
'simpledata' => true,
'staticacceleration' => true,
)
);
Zerion Mini Shell 1.0