instance method normalize_key

Ruby on Rails 8.1.2

Since v5.2.8.1 Private

Available in: v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

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

key req
options req
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

Type at least 2 characters to search.

↑↓ navigate · open · esc close