From d7bc3403102b92e8f88dfc9aec428a9f3ed3fd0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Mon, 7 Mar 2016 19:47:40 +0100 Subject: [PATCH] FIX: Emoji.clear_cached wasn't deleting the right caches --- app/models/emoji.rb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/models/emoji.rb b/app/models/emoji.rb index e636ae1686d..10755173b77 100644 --- a/app/models/emoji.rb +++ b/app/models/emoji.rb @@ -1,4 +1,7 @@ class Emoji + # update this to clear the cache + EMOJI_VERSION = "v2" + include ActiveModel::SerializerSupport attr_reader :path @@ -20,19 +23,19 @@ class Emoji end def self.all - Discourse.cache.fetch("all_emojis:v2") { standard | custom } + Discourse.cache.fetch("all_emojis:#{EMOJI_VERSION}") { standard | custom } end def self.standard - Discourse.cache.fetch("standard_emojis:v2") { load_standard } + Discourse.cache.fetch("standard_emojis:#{EMOJI_VERSION}") { load_standard } end def self.aliases - Discourse.cache.fetch("aliases_emojis:v2") { load_aliases } + Discourse.cache.fetch("aliases_emojis:#{EMOJI_VERSION}") { load_aliases } end def self.custom - Discourse.cache.fetch("custom_emojis:v2") { load_custom } + Discourse.cache.fetch("custom_emojis:#{EMOJI_VERSION}") { load_custom } end def self.exists?(name) @@ -76,10 +79,10 @@ class Emoji end def self.clear_cache - Discourse.cache.delete("custom_emojis") - Discourse.cache.delete("standard_emojis") - Discourse.cache.delete("aliases_emojis") - Discourse.cache.delete("all_emojis") + Discourse.cache.delete("custom_emojis:#{EMOJI_VERSION}") + Discourse.cache.delete("standard_emojis:#{EMOJI_VERSION}") + Discourse.cache.delete("aliases_emojis:#{EMOJI_VERSION}") + Discourse.cache.delete("all_emojis:#{EMOJI_VERSION}") end def self.db_file