instance method can_use_fast_cache_version?

Ruby on Rails 7.2.3

Since v6.0.6 Private

Available in: v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

can_use_fast_cache_version?(timestamp)

Detects if the value before type cast can be used to generate a cache_version.

The fast cache version only works with a string value directly from the database.

We also must check if the timestamp format has been changed or if the timezone is not set to UTC then we cannot apply our transformations correctly.

Parameters

timestamp req
Source
# File activerecord/lib/active_record/integration.rb, line 178
      def can_use_fast_cache_version?(timestamp)
        timestamp.is_a?(String) &&
          cache_timestamp_format == :usec &&
          # FIXME: checking out a connection for this is wasteful
          # we should store/cache this information in the schema cache
          # or similar.
          self.class.with_connection(&:default_timezone) == :utc &&
          !updated_at_came_from_user?
      end

Defined in activerecord/lib/active_record/integration.rb line 178 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Integration

Type at least 2 characters to search.

↑↓ navigate · open · esc close