instance method
truncate_key
Ruby on Rails edge
Since v8.1.3.1 Private — implementation detail, not part of the public APIAvailable in: v8.1.3.1 edge
Signature
truncate_key(key)
No documentation comment.
Parameters
-
keyreq
Source
# File activesupport/lib/active_support/cache.rb, line 993
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 993
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Cache::Store