diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2023-03-16 14:13:03 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-16 14:13:03 +1300 |
commit | 5f90c33e4ccee827cb5df3d8854dc72791345c51 (patch) | |
tree | 343a9d4e2dafdb84c2999a48ab657fb087306dd5 | |
parent | f75d08e11ba04ddb2351b6f3c655f41a991bec25 (diff) | |
download | rack-5f90c33e4ccee827cb5df3d8854dc72791345c51.tar.gz |
Prefer to use `query_parser` itself as the cache key. (#2058)
Change the cache hash table to use `compare_by_identity` for improved
semantics/performance.
-rw-r--r-- | lib/rack/request.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/rack/request.rb b/lib/rack/request.rb index 86e133cd..fbdead8a 100644 --- a/lib/rack/request.rb +++ b/lib/rack/request.rb @@ -523,7 +523,7 @@ module Rack # behaviour. This includes sub-classes that override query_parser or # expand_params. def cache_key - query_parser.class + query_parser end # Given a current input value, and a validity key, check if the cache @@ -560,7 +560,8 @@ module Rack # If the cache was not defined for this cache key, then create a new cache: unless cache - set_header(key, cache = {}) + cache = Hash.new.compare_by_identity + set_header(key, cache) end begin |