instance method
normalize_key
Ruby on Rails edge
Since v5.0.7.2 Private — implementation detail, not part of the public APISignature
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 305
def normalize_key(key, options)
key = expand_and_namespace_key(key, options)
key = key.b
key.gsub!(/[\x00-\x20%\x7F-\xFF]/n) { |match| "%#{match.getbyte(0).to_s(16).upcase}" }
truncate_key(key)
end
Defined in activesupport/lib/active_support/cache/mem_cache_store.rb line 305
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Cache::MemCacheStore