instance method raw_timestamp_to_cache_version

Ruby on Rails 7.0.10

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

raw_timestamp_to_cache_version(timestamp)

Converts a raw database string to :usec format.

Example:

timestamp = "2018-10-15 20:02:15.266505"
raw_timestamp_to_cache_version(timestamp)
# => "20181015200215266505"

PostgreSQL truncates trailing zeros, github.com/postgres/postgres/commit/3e1beda2cde3495f41290e1ece5d544525810214 to account for this we pad the output with zeros

Parameters

timestamp req
Source
# File activerecord/lib/active_record/integration.rb, line 197
      def raw_timestamp_to_cache_version(timestamp)
        key = timestamp.delete("- :.")
        if key.length < 20
          key.ljust(20, "0")
        else
          key
        end
      end

Defined in activerecord/lib/active_record/integration.rb line 197 · 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