instance method
truncate_key
Ruby on Rails 8.1.2
Since v8.1.2 Private — implementation detail, not part of the public APISignature
truncate_key(key)
No documentation comment.
Parameters
-
keyreq
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