From 9168480d1840ff4be01df78575fac641a2edd98d Mon Sep 17 00:00:00 2001 From: Jermolene Date: Sun, 2 Aug 2015 22:22:33 +0100 Subject: [PATCH] Clear caches when changing plugins --- boot/boot.js | 2 ++ core/modules/wiki.js | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/boot/boot.js b/boot/boot.js index 85f9b449b..d5e0a63e8 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -1083,6 +1083,8 @@ $tw.Wiki = function(options) { }); } }); + this.clearCache(null); + this.clearGlobalCache(); }; }; diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 234ba26d8..c2c0e22a2 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -742,11 +742,15 @@ exports.getCacheForTiddler = function(title,cacheName,initializer) { } }; -// Clear all caches associated with a particular tiddler +// Clear all caches associated with a particular tiddler, or, if the title is null, clear all the caches for all the tiddlers exports.clearCache = function(title) { - this.caches = this.caches || Object.create(null); - if($tw.utils.hop(this.caches,title)) { - delete this.caches[title]; + if(title) { + this.caches = this.caches || Object.create(null); + if($tw.utils.hop(this.caches,title)) { + delete this.caches[title]; + } + } else { + this.caches = Object.create(null); } };