Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 24... Línea 24...
24
 
24
 
Línea 25... Línea 25...
25
declare(strict_types=1);
25
declare(strict_types=1);
Línea -... Línea 26...
-
 
26
 
26
 
27
namespace mod_quiz\cache;
Línea 27... Línea 28...
27
namespace mod_quiz\cache;
28
 
28
 
29
use core_cache\data_source_interface;
29
use cache_definition;
30
use core_cache\definition;
30
 
31
 
31
/**
32
/**
32
 * Class quiz_overrides
33
 * Class quiz_overrides
33
 *
34
 *
34
 * @package   mod_quiz
35
 * @package   mod_quiz
35
 * @copyright 2021 Shamim Rezaie <shamim@moodle.com>
-
 
36
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36
 * @copyright 2021 Shamim Rezaie <shamim@moodle.com>
37
 */
37
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Línea 38... Línea 38...
38
class overrides implements \cache_data_source {
38
 */
39
 
39
class overrides implements data_source_interface {
40
    /** @var overrides the singleton instance of this class. */
40
    /** @var overrides the singleton instance of this class. */
41
    protected static $instance = null;
41
    protected static $instance = null;
42
 
42
 
43
    /**
43
    /**
44
     * Returns an instance of the data source class that the cache can use for loading data using the other methods
44
     * Returns an instance of the data source class that the cache can use for loading data using the other methods
45
     * specified by this interface.
45
     * specified by this interface.
46
     *
46
     *
47
     * @param cache_definition $definition
47
     * @param definition $definition
48
     * @return stdClass
48
     * @return overrides
49
     */
49
     */
50
    public static function get_instance_for_cache(cache_definition $definition): overrides {
50
    public static function get_instance_for_cache(definition $definition): overrides {
Línea 62... Línea 62...
62
     * @throws \coding_exception
62
     * @throws \coding_exception
63
     */
63
     */
64
    public function load_for_cache($key) {
64
    public function load_for_cache($key) {
65
        global $DB;
65
        global $DB;
Línea 66... Línea 66...
66
 
66
 
67
        // Ignore getting data if this is a cache invalidation - {@see \cache_helper::purge_by_event()}.
67
        // Ignore getting data if this is a cache invalidation - {@see \core_cache\helper::purge_by_event()}.
68
        if ($key == 'lastinvalidation') {
68
        if ($key == 'lastinvalidation') {
69
            return null;
69
            return null;
Línea 70... Línea 70...
70
        }
70
        }