mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 21:16:22 +00:00
invalidar la caché si el post cambia
This commit is contained in:
parent
e65c8e163b
commit
3fa6ca4e1e
1 changed files with 11 additions and 0 deletions
|
@ -75,10 +75,21 @@ class Post < OpenStruct
|
||||||
'posts/' + uuid.value
|
'posts/' + uuid.value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cache_version
|
||||||
|
updated_at.utc.to_s(:usec)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Agregar el timestamp para saber si cambió, siguiendo el módulo
|
||||||
|
# ActiveRecord::Integration
|
||||||
|
def cache_key_with_version
|
||||||
|
cache_key + '-' + cache_version
|
||||||
|
end
|
||||||
|
|
||||||
# TODO: Convertir a UUID?
|
# TODO: Convertir a UUID?
|
||||||
def id
|
def id
|
||||||
path.basename
|
path.basename
|
||||||
end
|
end
|
||||||
|
alias to_param id
|
||||||
|
|
||||||
def updated_at
|
def updated_at
|
||||||
File.mtime(path.absolute)
|
File.mtime(path.absolute)
|
||||||
|
|
Loading…
Reference in a new issue