MDL-64719 cache: Implement purge_current_user() in \cache
authorLeon Stringer <leon@priorsvle.com>
Fri, 29 Mar 2019 16:13:30 +0000 (16:13 +0000)
committerLeon Stringer <leon@priorsvle.com>
Mon, 1 Apr 2019 14:29:39 +0000 (15:29 +0100)
\cache::make() may return a cache_disabled subclass but callers, specifically
user/lib.php:user_create_user(), invoke \cache::purge_current_user() which was
only implemented by the cache_session subclass.  Added empty
\cache::purge_current_user() which subclasses can implement, i.e.
cache_session, or not, i.e. cache_disabled.

cache/classes/loaders.php

index 6b1337f..8cd7914 100644 (file)
@@ -1284,6 +1284,13 @@ class cache implements cache_loader {
             return -1;
         }
     }
+
+    /**
+     * Subclasses may support purging cache of all data belonging to the
+     * current user.
+     */
+    public function purge_current_user() {
+    }
 }
 
 /**