Skip to content

Commit aeb0fa4

Browse files
authored
Merge pull request rails#53002 from skipkayhil/hm-rm-cache-key-allocation
Remove hash allocation in Store#namespace_key
2 parents 7673e8f + b87e1e6 commit aeb0fa4

File tree

1 file changed

+6
-3
lines changed
  • activesupport/lib/active_support

1 file changed

+6
-3
lines changed

activesupport/lib/active_support/cache.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -945,9 +945,12 @@ def normalize_key(key, options = nil)
945945
#
946946
# namespace_key 'foo', namespace: -> { 'cache' }
947947
# # => 'cache:foo'
948-
def namespace_key(key, options = nil)
949-
options = merged_options(options)
950-
namespace = options[:namespace]
948+
def namespace_key(key, call_options = nil)
949+
namespace = if call_options&.key?(:namespace)
950+
call_options[:namespace]
951+
else
952+
options[:namespace]
953+
end
951954

952955
if namespace.respond_to?(:call)
953956
namespace = namespace.call

0 commit comments

Comments
 (0)