class ActiveSupport::Cache::Store

def expanded_key(key)

called. If the key is a Hash, then keys will be sorted alphabetically.
object responds to +cache_key+. Otherwise, +to_param+ method will be
Expands key to be a consistent string value. Invokes +cache_key+ if
def expanded_key(key)
  return key.cache_key.to_s if key.respond_to?(:cache_key)
  case key
  when Array
    if key.size > 1
      key = key.collect { |element| expanded_key(element) }
    else
      key = expanded_key(key.first)
    end
  when Hash
    key = key.sort_by { |k, _| k.to_s }.collect { |k, v| "#{k}=#{v}" }
  end
  key.to_param
end