From 59ca73ff82fcbac897ccbb75992f6feb66d77c44 Mon Sep 17 00:00:00 2001 From: Matteo Scaramuccia Date: Sun, 2 Dec 2012 21:35:21 +0100 Subject: [PATCH] MDL-36363 Override instance_deleted() for all cache stores performing just a cleanup() when this action successfully applies over all the definitions of the cache store --- cache/stores/memcache/lib.php | 11 +++++++++++ cache/stores/memcached/lib.php | 11 +++++++++++ cache/stores/mongodb/lib.php | 11 +++++++++++ cache/stores/session/lib.php | 11 +++++++++++ cache/stores/static/lib.php | 11 +++++++++++ 5 files changed, 55 insertions(+) diff --git a/cache/stores/memcache/lib.php b/cache/stores/memcache/lib.php index 80c5a33c391..044831580f2 100644 --- a/cache/stores/memcache/lib.php +++ b/cache/stores/memcache/lib.php @@ -323,6 +323,17 @@ class cachestore_memcache extends cache_store implements cache_is_configurable { $this->purge(); } + /** + * Performs any necessary operation when the store instance is being deleted, + * regardless the store being initialised with a definition ({@link initialise()}). + * + * @link http://tracker.moodle.org/browse/MDL-36363 + * @see cleanup() + */ + public function instance_deleted() { + $this->cleanup(); + } + /** * Generates an instance of the cache store that can be used for testing. * diff --git a/cache/stores/memcached/lib.php b/cache/stores/memcached/lib.php index 44a11b9ca6b..f49d7077248 100644 --- a/cache/stores/memcached/lib.php +++ b/cache/stores/memcached/lib.php @@ -405,6 +405,17 @@ class cachestore_memcached extends cache_store implements cache_is_configurable $this->purge(); } + /** + * Performs any necessary operation when the store instance is being deleted, + * regardless the store being initialised with a definition ({@link initialise()}). + * + * @link http://tracker.moodle.org/browse/MDL-36363 + * @see cleanup() + */ + public function instance_deleted() { + $this->cleanup(); + } + /** * Generates an instance of the cache store that can be used for testing. * diff --git a/cache/stores/mongodb/lib.php b/cache/stores/mongodb/lib.php index 4ee7752cd86..f82b94fbd36 100644 --- a/cache/stores/mongodb/lib.php +++ b/cache/stores/mongodb/lib.php @@ -443,6 +443,17 @@ class cachestore_mongodb extends cache_store implements cache_is_configurable { $this->purge(); } + /** + * Performs any necessary operation when the store instance is being deleted, + * regardless the store being initialised with a definition ({@link initialise()}). + * + * @link http://tracker.moodle.org/browse/MDL-36363 + * @see cleanup() + */ + public function instance_deleted() { + $this->cleanup(); + } + /** * Generates an instance of the cache store that can be used for testing. * diff --git a/cache/stores/session/lib.php b/cache/stores/session/lib.php index 2ec9a948faa..28b41d70a90 100644 --- a/cache/stores/session/lib.php +++ b/cache/stores/session/lib.php @@ -379,6 +379,17 @@ class cachestore_session extends session_data_store implements cache_is_key_awar $this->purge(); } + /** + * Performs any necessary operation when the store instance is being deleted, + * regardless the store being initialised with a definition ({@link initialise()}). + * + * @link http://tracker.moodle.org/browse/MDL-36363 + * @see cleanup() + */ + public function instance_deleted() { + $this->cleanup(); + } + /** * Generates an instance of the cache store that can be used for testing. * diff --git a/cache/stores/static/lib.php b/cache/stores/static/lib.php index 7281fad49b1..53b7734487b 100644 --- a/cache/stores/static/lib.php +++ b/cache/stores/static/lib.php @@ -376,6 +376,17 @@ class cachestore_static extends static_data_store implements cache_is_key_aware $this->purge(); } + /** + * Performs any necessary operation when the store instance is being deleted, + * regardless the store being initialised with a definition ({@link initialise()}). + * + * @link http://tracker.moodle.org/browse/MDL-36363 + * @see cleanup() + */ + public function instance_deleted() { + $this->cleanup(); + } + /** * Generates an instance of the cache store that can be used for testing. *