instance method
cache_version
Ruby on Rails 5.2.8.1
Since v5.2.8.1Signature
cache_version()
Returns a cache version that can be used together with the cache key to form a recyclable caching scheme. By default, the #updated_at column is used for the cache_version, but this method can be overwritten to return something else.
Note, this method will return nil if ActiveRecord::Base.cache_versioning is set to false (which it is by default until Rails 6.0).
Source
# File activerecord/lib/active_record/integration.rb, line 98
def cache_version
if cache_versioning && timestamp = try(:updated_at)
timestamp.utc.to_s(:usec)
end
end
Defined in activerecord/lib/active_record/integration.rb line 98
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Integration