MDL-36322 cache: implemented cache_store::create_clone

This commit is contained in:
Sam Hemelryk
2013-02-01 08:49:03 +13:00
parent 5dfa3031a8
commit 79c55ca344
2 changed files with 25 additions and 1 deletions
+18
View File
@@ -306,4 +306,22 @@ abstract class cache_store implements cache_store_interface {
public function supports_native_ttl() {
return $this::get_supported_features() & self::SUPPORTS_NATIVE_TTL;
}
/**
* Creates a clone of this store instance ready to be initialised.
*
* This method is used so that a cache store needs only be constructed once.
* Future requests for an instance of the store will be given a cloned instance.
*
* If you are writing a cache store that isn't compatible with the clone operation
* you can override this method to handle any situations you want before cloning.
*
* @param array $details An array containing the details of the store from the cache config.
* @return cache_store
*/
public function create_clone(array $details = array()) {
// By default we just run clone.
// Any stores that have an issue with this will need to override the create_clone method.
return clone($this);
}
}