Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 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
namespace core_cache;
18
 
19
/**
20
 * Versionable cache data source.
21
 *
22
 * This interface extends the main cache data source interface to add an extra required method if
23
 * the data source is to be used for a versioned cache.
24
 *
25
 * @package core_cache
26
 * @copyright Sam Hemelryk
27
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28
 */
29
interface versionable_data_source_interface extends data_source_interface {
30
    /**
31
     * Loads the data for the key provided ready formatted for caching.
32
     *
33
     * If there is no data for that key, or if the data for the required key has an older version
34
     * than the specified $requiredversion, then this returns null.
35
     *
36
     * If there is data then $actualversion should be set to the actual version number retrieved
37
     * (may be the same as $requiredversion or newer).
38
     *
39
     * @param string|int $key The key to load.
40
     * @param int $requiredversion Minimum required version
41
     * @param mixed $actualversion Should be set to the actual version number retrieved
42
     * @return mixed What ever data should be returned, or false if it can't be loaded.
43
     */
44
    public function load_for_cache_versioned($key, int $requiredversion, &$actualversion);
45
}
46
 
47
// Alias this class to the old name.
48
// This file will be autoloaded by the legacyclasses autoload system.
49
// In future all uses of this class will be corrected and the legacy references will be removed.
50
class_alias(versionable_data_source_interface::class, \cache_data_source_versionable::class);