instance method
normalize_key
Ruby on Rails 8.1.2
Since v5.2.8.1 PrivateSignature
normalize_key(key, options)
Memcache keys are binaries. So we need to force their encoding to binary before applying the regular expression to ensure we are escaping all characters properly.
Parameters
-
keyreq -
optionsreq
Source
# File activesupport/lib/active_support/cache/mem_cache_store.rb, line 258
def normalize_key(key, options)
key = expand_and_namespace_key(key, options)
if key
key = key.dup.force_encoding(Encoding::ASCII_8BIT)
key = key.gsub(ESCAPE_KEY_CHARS) { |match| "%#{match.getbyte(0).to_s(16).upcase}" }
end
truncate_key(key)
end
Defined in activesupport/lib/active_support/cache/mem_cache_store.rb line 258
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Cache::MemCacheStore