Módulo: Mongoid::Cacheable
Overview
Encapsula el comportamiento relacionado con el almacenamiento en caché.
Resumen del método de instancia colapsar
-
#cache_key ⇒ String
Imprime la clave de caché.
Detalles del método de instancia
#cache_key ⇒ String
Imprime la clave de caché. Esto añadirá diferentes valores en el nombre del modelo plural.
Si new_record? - añadirá /nuevo Si no - añadirá /id-updated_at.to_formatted_s(cache_timestamp_format) Sin updated_at: se añadirá /id
Esto suele llamarse dentro de un bloque caché()
28 29 30 31 32 |
# Archivo 'lib/mongoid/cacheable.rb', línea 28 def cache_key return "#{model_key}/new" si nuevo_registro? return "#{model_key}/#{_id}-#{updated_at.utc.to_formatted_s()}" si intentar(:updated_at) "#{model_key}/#{_id}" end |