mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 19:06:41 +02:00
MDL-82158 core_cache: Move cache stores
This commit is contained in:
parent
4038c52928
commit
c5ff1b053f
4 changed files with 76 additions and 64 deletions
62
cache/classes/store.php
vendored
62
cache/classes/store.php
vendored
|
@ -26,68 +26,6 @@
|
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Cache store interface.
|
||||
*
|
||||
* This interface defines the static methods that must be implemented by every cache store plugin.
|
||||
* To ensure plugins implement this class the abstract cache_store class implements this interface.
|
||||
*
|
||||
* @package core
|
||||
* @category cache
|
||||
* @copyright 2012 Sam Hemelryk
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
interface cache_store_interface {
|
||||
/**
|
||||
* Static method to check if the store requirements are met.
|
||||
*
|
||||
* @return bool True if the stores software/hardware requirements have been met and it can be used. False otherwise.
|
||||
*/
|
||||
public static function are_requirements_met();
|
||||
|
||||
/**
|
||||
* Static method to check if a store is usable with the given mode.
|
||||
*
|
||||
* @param int $mode One of cache_store::MODE_*
|
||||
*/
|
||||
public static function is_supported_mode($mode);
|
||||
|
||||
/**
|
||||
* Returns the supported features as a binary flag.
|
||||
*
|
||||
* @param array $configuration The configuration of a store to consider specifically.
|
||||
* @return int The supported features.
|
||||
*/
|
||||
public static function get_supported_features(array $configuration = array());
|
||||
|
||||
/**
|
||||
* Returns the supported modes as a binary flag.
|
||||
*
|
||||
* @param array $configuration The configuration of a store to consider specifically.
|
||||
* @return int The supported modes.
|
||||
*/
|
||||
public static function get_supported_modes(array $configuration = array());
|
||||
|
||||
/**
|
||||
* Generates an instance of the cache store that can be used for testing.
|
||||
*
|
||||
* Returns an instance of the cache store, or false if one cannot be created.
|
||||
*
|
||||
* @param cache_definition $definition
|
||||
* @return cache_store|false
|
||||
*/
|
||||
public static function initialise_test_instance(cache_definition $definition);
|
||||
|
||||
/**
|
||||
* Generates the appropriate configuration required for unit testing.
|
||||
*
|
||||
* @return array Array of unit test configuration data to be used by initialise().
|
||||
*/
|
||||
public static function unit_test_configuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract cache store class.
|
||||
*
|
||||
|
|
75
cache/classes/store_interface.php
vendored
Normal file
75
cache/classes/store_interface.php
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?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/>.
|
||||
|
||||
/**
|
||||
* Cache store interface.
|
||||
*
|
||||
* This interface defines the static methods that must be implemented by every cache store plugin.
|
||||
* To ensure plugins implement this class the abstract cache_store class implements this interface.
|
||||
*
|
||||
* @package core
|
||||
* @category cache
|
||||
* @copyright 2012 Sam Hemelryk
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
interface cache_store_interface {
|
||||
/**
|
||||
* Static method to check if the store requirements are met.
|
||||
*
|
||||
* @return bool True if the stores software/hardware requirements have been met and it can be used. False otherwise.
|
||||
*/
|
||||
public static function are_requirements_met();
|
||||
|
||||
/**
|
||||
* Static method to check if a store is usable with the given mode.
|
||||
*
|
||||
* @param int $mode One of cache_store::MODE_*
|
||||
*/
|
||||
public static function is_supported_mode($mode);
|
||||
|
||||
/**
|
||||
* Returns the supported features as a binary flag.
|
||||
*
|
||||
* @param array $configuration The configuration of a store to consider specifically.
|
||||
* @return int The supported features.
|
||||
*/
|
||||
public static function get_supported_features(array $configuration = array());
|
||||
|
||||
/**
|
||||
* Returns the supported modes as a binary flag.
|
||||
*
|
||||
* @param array $configuration The configuration of a store to consider specifically.
|
||||
* @return int The supported modes.
|
||||
*/
|
||||
public static function get_supported_modes(array $configuration = array());
|
||||
|
||||
/**
|
||||
* Generates an instance of the cache store that can be used for testing.
|
||||
*
|
||||
* Returns an instance of the cache store, or false if one cannot be created.
|
||||
*
|
||||
* @param cache_definition $definition
|
||||
* @return cache_store|false
|
||||
*/
|
||||
public static function initialise_test_instance(cache_definition $definition);
|
||||
|
||||
/**
|
||||
* Generates the appropriate configuration required for unit testing.
|
||||
*
|
||||
* @return array Array of unit test configuration data to be used by initialise().
|
||||
*/
|
||||
public static function unit_test_configuration();
|
||||
}
|
1
cache/lib.php
vendored
1
cache/lib.php
vendored
|
@ -31,5 +31,4 @@
|
|||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
// Include the required classes.
|
||||
require_once($CFG->dirroot.'/cache/classes/store.php');
|
||||
require_once($CFG->dirroot.'/cache/classes/definition.php');
|
||||
|
|
|
@ -70,8 +70,8 @@ $legacyclasses = [
|
|||
\cache_loader_with_locking::class => 'loader_with_locking_interface.php',
|
||||
\cache_lock_interface::class => 'cache_lock_interface.php',
|
||||
\cache_store::class => 'store.php',
|
||||
\cache_ttl_wrapper::class => 'ttl_wrapper.php',
|
||||
\cache_store_interface::class => 'store_interface.php',
|
||||
\cache_ttl_wrapper::class => 'ttl_wrapper.php',
|
||||
\cacheable_object::class => 'cacheable_object_interface.php',
|
||||
\cacheable_object_array::class => 'cacheable_object_array.php',
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue