mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 02:11:42 +00:00
Merge branch 'renovar-cache' into 'rails'
renovar la caché de formularios See merge request sutty/sutty!12
This commit is contained in:
commit
dffae5a49f
1 changed files with 7 additions and 1 deletions
|
@ -19,10 +19,16 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type,
|
||||||
@cache_key ||= "post/#{post.uuid.value}/#{name}"
|
@cache_key ||= "post/#{post.uuid.value}/#{name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Genera una versión de caché en base a la fecha de modificación del
|
||||||
|
# Post, el valor actual y los valores posibles, de forma que cualquier
|
||||||
|
# cambio permita renovar la caché.
|
||||||
|
#
|
||||||
|
# @return [String]
|
||||||
def cache_version
|
def cache_version
|
||||||
value.hash.to_s + values.hash.to_s
|
post.cache_version + value.hash.to_s + values.hash.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @return [String]
|
||||||
def cache_key_with_version
|
def cache_key_with_version
|
||||||
"#{cache_key}-#{cache_version}"
|
"#{cache_key}-#{cache_version}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue