use Cache.hash instead of Cache.sanitize

This commit is contained in:
r888888888
2017-08-24 15:43:38 -07:00
parent 18f617e08a
commit b769b83262
6 changed files with 10 additions and 10 deletions

View File

@@ -1183,7 +1183,7 @@ class Post < ApplicationRecord
tags = "#{tags} -status:deleted".strip
end
"pfc:#{Cache.sanitize(tags)}"
"pfc:#{Cache.hash(tags)}"
end
def fast_count(tags = "", options = {})

View File

@@ -99,7 +99,7 @@ class Tag < ApplicationRecord
if options[:disable_caching]
select_category_for(tag_name)
else
Cache.get("tc:#{Cache.sanitize(tag_name)}") do
Cache.get("tc:#{Cache.hash(tag_name)}") do
select_category_for(tag_name)
end
end
@@ -146,7 +146,7 @@ class Tag < ApplicationRecord
end
def update_category_cache
Cache.put("tc:#{Cache.sanitize(name)}", category, 1.hour)
Cache.put("tc:#{Cache.hash(name)}", category, 1.hour)
end
end
@@ -752,7 +752,7 @@ class Tag < ApplicationRecord
if post_count < COSINE_SIMILARITY_RELATED_TAG_THRESHOLD
delay(:queue => "default").update_related
elsif post_count >= COSINE_SIMILARITY_RELATED_TAG_THRESHOLD
key = Cache.sanitize(name)
key = Cache.hash(name)
cache_check = Cache.get("urt:#{key}")
if cache_check

View File

@@ -20,7 +20,7 @@ class TagAlias < TagRelationship
module ClassMethods
def clear_cache_for(name)
Cache.delete("ta:#{Cache.sanitize(name)}")
Cache.delete("ta:#{Cache.hash(name)}")
end
end