Skip to content

Commit b368c68

Browse files
committed
Reduce Array object allocation
1 parent 4e7620b commit b368c68

File tree

1 file changed

+1
-3
lines changed
  • actionpack/lib/action_dispatch/http

1 file changed

+1
-3
lines changed

actionpack/lib/action_dispatch/http/cache.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,13 @@ def generate_strong_etag(validators)
138138
def cache_control_segments
139139
if cache_control = _cache_control
140140
cache_control.delete(" ").split(",")
141-
else
142-
[]
143141
end
144142
end
145143

146144
def cache_control_headers
147145
cache_control = {}
148146

149-
cache_control_segments.each do |segment|
147+
cache_control_segments&.each do |segment|
150148
directive, argument = segment.split("=", 2)
151149

152150
if SPECIAL_KEYS.include? directive

0 commit comments

Comments
 (0)