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 |
* Cache store interface.
|
|
|
21 |
*
|
|
|
22 |
* This interface defines the static methods that must be implemented by every cache store plugin.
|
|
|
23 |
* To ensure plugins implement this class the abstract store class implements this interface.
|
|
|
24 |
*
|
|
|
25 |
* @package core_cache
|
|
|
26 |
* @category cache
|
|
|
27 |
* @copyright 2012 Sam Hemelryk
|
|
|
28 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
29 |
*/
|
|
|
30 |
interface store_interface {
|
|
|
31 |
/**
|
|
|
32 |
* Static method to check if the store requirements are met.
|
|
|
33 |
*
|
|
|
34 |
* @return bool True if the stores software/hardware requirements have been met and it can be used. False otherwise.
|
|
|
35 |
*/
|
|
|
36 |
public static function are_requirements_met();
|
|
|
37 |
|
|
|
38 |
/**
|
|
|
39 |
* Static method to check if a store is usable with the given mode.
|
|
|
40 |
*
|
|
|
41 |
* @param int $mode One of store::MODE_*
|
|
|
42 |
*/
|
|
|
43 |
public static function is_supported_mode($mode);
|
|
|
44 |
|
|
|
45 |
/**
|
|
|
46 |
* Returns the supported features as a binary flag.
|
|
|
47 |
*
|
|
|
48 |
* @param array $configuration The configuration of a store to consider specifically.
|
|
|
49 |
* @return int The supported features.
|
|
|
50 |
*/
|
|
|
51 |
public static function get_supported_features(array $configuration = []);
|
|
|
52 |
|
|
|
53 |
/**
|
|
|
54 |
* Returns the supported modes as a binary flag.
|
|
|
55 |
*
|
|
|
56 |
* @param array $configuration The configuration of a store to consider specifically.
|
|
|
57 |
* @return int The supported modes.
|
|
|
58 |
*/
|
|
|
59 |
public static function get_supported_modes(array $configuration = []);
|
|
|
60 |
|
|
|
61 |
/**
|
|
|
62 |
* Generates an instance of the cache store that can be used for testing.
|
|
|
63 |
*
|
|
|
64 |
* Returns an instance of the cache store, or false if one cannot be created.
|
|
|
65 |
*
|
|
|
66 |
* @param definition $definition
|
|
|
67 |
* @return store_interface|false
|
|
|
68 |
*/
|
|
|
69 |
public static function initialise_test_instance(definition $definition);
|
|
|
70 |
|
|
|
71 |
/**
|
|
|
72 |
* Generates the appropriate configuration required for unit testing.
|
|
|
73 |
*
|
|
|
74 |
* @return array Array of unit test configuration data to be used by initialise().
|
|
|
75 |
*/
|
|
|
76 |
public static function unit_test_configuration();
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
// Alias this class to the old name.
|
|
|
80 |
// This file will be autoloaded by the legacyclasses autoload system.
|
|
|
81 |
// In future all uses of this class will be corrected and the legacy references will be removed.
|
|
|
82 |
class_alias(store_interface::class, \cache_store_interface::class);
|