instance method truncate_key

Ruby on Rails 8.1.2

Since v8.1.2 Private — implementation detail, not part of the public API

Signature

truncate_key(key)

No documentation comment.

Parameters

key req
Source
# File activesupport/lib/active_support/cache.rb, line 991
        def truncate_key(key)
          if key && @max_key_size && key.bytesize > @max_key_size
            suffix = ":hash:#{ActiveSupport::Digest.hexdigest(key)}"
            truncate_at = @max_key_size - suffix.bytesize
            key = key.byteslice(0, truncate_at)
            key.scrub!("")
            "#{key}#{suffix}"
          else
            key
          end
        end

Defined in activesupport/lib/active_support/cache.rb line 991 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::Cache::Store

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close