aplicar la caché a los valores de referencia también
This commit is contained in:
parent
781cba24de
commit
90a92ec25d
2 changed files with 7 additions and 5 deletions
|
@ -20,7 +20,7 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type,
|
|||
end
|
||||
|
||||
def cache_version
|
||||
value.hash.to_s
|
||||
value.hash.to_s + values.hash.to_s
|
||||
end
|
||||
|
||||
def cache_key_with_version
|
||||
|
|
|
@ -291,11 +291,13 @@ class Site < ApplicationRecord
|
|||
# @param attr [Symbol|String] El atributo a buscar
|
||||
# @return Array
|
||||
def everything_of(attr, lang: nil)
|
||||
attr = attr.to_sym
|
||||
Rails.cache.fetch("#{cache_key_with_version}/everything_of/#{lang}/#{attr}", expires_in: 1.hour) do
|
||||
attr = attr.to_sym
|
||||
|
||||
posts(lang: lang).flat_map do |p|
|
||||
p[attr].value if p.attribute? attr
|
||||
end.uniq.compact
|
||||
posts(lang: lang).flat_map do |p|
|
||||
p[attr].value if p.attribute? attr
|
||||
end.uniq.compact
|
||||
end
|
||||
end
|
||||
|
||||
# Poner en la cola de compilación
|
||||
|
|
Loading…
Reference in a new issue