FIX: Emoji.clear_cached wasn't deleting the right caches

This commit is contained in:
Régis Hanol 2016-03-07 19:47:40 +01:00
parent b49e0e0f4a
commit d7bc340310

View File

@ -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