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