MDL-53208 caching: Enable dereferencing as a feature.
If the cache does all the dereferencing when it stores and loads the objects, then the cache loaders don't need to do that work. This is true of all caches that use something other than PHP's memory to store their results.
This commit is contained in:
Vendored
+17
@@ -126,6 +126,14 @@ abstract class cache_store implements cache_store_interface {
|
||||
*/
|
||||
const IS_SEARCHABLE = 8;
|
||||
|
||||
/**
|
||||
* The cache store dereferences objects.@global
|
||||
*
|
||||
* When set, loaders will assume that all data coming from this store has already had all references
|
||||
* resolved. So even for complex object structures it will not try to remove references again.
|
||||
*/
|
||||
const DEREFERENCES_OBJECTS = 16;
|
||||
|
||||
// Constants for the modes of a cache store
|
||||
|
||||
/**
|
||||
@@ -334,6 +342,15 @@ abstract class cache_store implements cache_store_interface {
|
||||
return in_array('cache_is_searchable', class_implements($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the store automatically dereferences objects.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function supports_dereferencing_objects() {
|
||||
return $this::get_supported_features() & self::DEREFERENCES_OBJECTS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a clone of this store instance ready to be initialised.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user