activesupport 4.2.11.1 → 5.2.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +399 -440
- data/MIT-LICENSE +2 -2
- data/README.rdoc +4 -5
- data/lib/active_support/all.rb +5 -3
- data/lib/active_support/array_inquirer.rb +48 -0
- data/lib/active_support/backtrace_cleaner.rb +7 -5
- data/lib/active_support/benchmarkable.rb +6 -4
- data/lib/active_support/builder.rb +3 -1
- data/lib/active_support/cache/file_store.rb +41 -35
- data/lib/active_support/cache/mem_cache_store.rb +97 -88
- data/lib/active_support/cache/memory_store.rb +27 -30
- data/lib/active_support/cache/null_store.rb +7 -8
- data/lib/active_support/cache/redis_cache_store.rb +461 -0
- data/lib/active_support/cache/strategy/local_cache.rb +67 -34
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +10 -9
- data/lib/active_support/cache.rb +287 -196
- data/lib/active_support/callbacks.rb +640 -590
- data/lib/active_support/concern.rb +11 -5
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +17 -0
- data/lib/active_support/concurrency/share_lock.rb +227 -0
- data/lib/active_support/configurable.rb +8 -5
- data/lib/active_support/core_ext/array/access.rb +29 -1
- data/lib/active_support/core_ext/array/conversions.rb +22 -18
- data/lib/active_support/core_ext/array/extract_options.rb +2 -0
- data/lib/active_support/core_ext/array/grouping.rb +11 -18
- data/lib/active_support/core_ext/array/inquiry.rb +19 -0
- data/lib/active_support/core_ext/array/prepend_and_append.rb +5 -3
- data/lib/active_support/core_ext/array/wrap.rb +7 -4
- data/lib/active_support/core_ext/array.rb +9 -6
- data/lib/active_support/core_ext/benchmark.rb +3 -1
- data/lib/active_support/core_ext/big_decimal/conversions.rb +10 -12
- data/lib/active_support/core_ext/big_decimal.rb +3 -1
- data/lib/active_support/core_ext/class/attribute.rb +41 -22
- data/lib/active_support/core_ext/class/attribute_accessors.rb +3 -1
- data/lib/active_support/core_ext/class/subclasses.rb +20 -6
- data/lib/active_support/core_ext/class.rb +4 -3
- data/lib/active_support/core_ext/date/acts_like.rb +3 -1
- data/lib/active_support/core_ext/date/blank.rb +14 -0
- data/lib/active_support/core_ext/date/calculations.rb +11 -9
- data/lib/active_support/core_ext/date/conversions.rb +25 -23
- data/lib/active_support/core_ext/date/zones.rb +4 -2
- data/lib/active_support/core_ext/date.rb +6 -4
- data/lib/active_support/core_ext/date_and_time/calculations.rb +170 -58
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +4 -3
- data/lib/active_support/core_ext/date_and_time/zones.rb +12 -12
- data/lib/active_support/core_ext/date_time/acts_like.rb +4 -2
- data/lib/active_support/core_ext/date_time/blank.rb +14 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +36 -18
- data/lib/active_support/core_ext/date_time/compatibility.rb +8 -6
- data/lib/active_support/core_ext/date_time/conversions.rb +16 -12
- data/lib/active_support/core_ext/date_time.rb +7 -5
- data/lib/active_support/core_ext/digest/uuid.rb +7 -5
- data/lib/active_support/core_ext/digest.rb +3 -0
- data/lib/active_support/core_ext/enumerable.rb +101 -33
- data/lib/active_support/core_ext/file/atomic.rb +38 -31
- data/lib/active_support/core_ext/file.rb +3 -1
- data/lib/active_support/core_ext/hash/compact.rb +14 -9
- data/lib/active_support/core_ext/hash/conversions.rb +62 -41
- data/lib/active_support/core_ext/hash/deep_merge.rb +9 -13
- data/lib/active_support/core_ext/hash/except.rb +11 -8
- data/lib/active_support/core_ext/hash/indifferent_access.rb +4 -3
- data/lib/active_support/core_ext/hash/keys.rb +33 -27
- data/lib/active_support/core_ext/hash/reverse_merge.rb +5 -2
- data/lib/active_support/core_ext/hash/slice.rb +8 -8
- data/lib/active_support/core_ext/hash/transform_values.rb +14 -5
- data/lib/active_support/core_ext/hash.rb +11 -9
- data/lib/active_support/core_ext/integer/inflections.rb +3 -1
- data/lib/active_support/core_ext/integer/multiple.rb +2 -0
- data/lib/active_support/core_ext/integer/time.rb +11 -18
- data/lib/active_support/core_ext/integer.rb +5 -3
- data/lib/active_support/core_ext/kernel/agnostics.rb +2 -0
- data/lib/active_support/core_ext/kernel/concern.rb +5 -1
- data/lib/active_support/core_ext/kernel/reporting.rb +4 -84
- data/lib/active_support/core_ext/kernel/singleton_class.rb +2 -0
- data/lib/active_support/core_ext/kernel.rb +6 -5
- data/lib/active_support/core_ext/load_error.rb +3 -22
- data/lib/active_support/core_ext/marshal.rb +8 -8
- data/lib/active_support/core_ext/module/aliasing.rb +6 -44
- data/lib/active_support/core_ext/module/anonymous.rb +12 -1
- data/lib/active_support/core_ext/module/attr_internal.rb +8 -9
- data/lib/active_support/core_ext/module/attribute_accessors.rb +43 -40
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +150 -0
- data/lib/active_support/core_ext/module/concerning.rb +11 -12
- data/lib/active_support/core_ext/module/delegation.rb +99 -29
- data/lib/active_support/core_ext/module/deprecation.rb +4 -2
- data/lib/active_support/core_ext/module/introspection.rb +9 -9
- data/lib/active_support/core_ext/module/reachable.rb +5 -2
- data/lib/active_support/core_ext/module/redefine_method.rb +49 -0
- data/lib/active_support/core_ext/module/remove_method.rb +8 -3
- data/lib/active_support/core_ext/module.rb +14 -11
- data/lib/active_support/core_ext/name_error.rb +22 -2
- data/lib/active_support/core_ext/numeric/bytes.rb +22 -0
- data/lib/active_support/core_ext/numeric/conversions.rb +78 -81
- data/lib/active_support/core_ext/numeric/inquiry.rb +28 -0
- data/lib/active_support/core_ext/numeric/time.rb +35 -23
- data/lib/active_support/core_ext/numeric.rb +6 -3
- data/lib/active_support/core_ext/object/acts_like.rb +12 -1
- data/lib/active_support/core_ext/object/blank.rb +27 -2
- data/lib/active_support/core_ext/object/conversions.rb +6 -4
- data/lib/active_support/core_ext/object/deep_dup.rb +13 -4
- data/lib/active_support/core_ext/object/duplicable.rb +41 -14
- data/lib/active_support/core_ext/object/inclusion.rb +5 -3
- data/lib/active_support/core_ext/object/instance_variables.rb +3 -1
- data/lib/active_support/core_ext/object/json.rb +49 -19
- data/lib/active_support/core_ext/object/to_param.rb +3 -1
- data/lib/active_support/core_ext/object/to_query.rb +10 -5
- data/lib/active_support/core_ext/object/try.rb +69 -21
- data/lib/active_support/core_ext/object/with_options.rb +16 -3
- data/lib/active_support/core_ext/object.rb +14 -13
- data/lib/active_support/core_ext/range/compare_range.rb +61 -0
- data/lib/active_support/core_ext/range/conversions.rb +27 -7
- data/lib/active_support/core_ext/range/each.rb +19 -17
- data/lib/active_support/core_ext/range/include_range.rb +2 -22
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +23 -0
- data/lib/active_support/core_ext/range/overlaps.rb +2 -0
- data/lib/active_support/core_ext/range.rb +7 -4
- data/lib/active_support/core_ext/regexp.rb +6 -0
- data/lib/active_support/core_ext/securerandom.rb +25 -0
- data/lib/active_support/core_ext/string/access.rb +8 -6
- data/lib/active_support/core_ext/string/behavior.rb +3 -1
- data/lib/active_support/core_ext/string/conversions.rb +7 -4
- data/lib/active_support/core_ext/string/exclude.rb +2 -0
- data/lib/active_support/core_ext/string/filters.rb +6 -5
- data/lib/active_support/core_ext/string/indent.rb +6 -4
- data/lib/active_support/core_ext/string/inflections.rb +61 -24
- data/lib/active_support/core_ext/string/inquiry.rb +3 -1
- data/lib/active_support/core_ext/string/multibyte.rb +15 -7
- data/lib/active_support/core_ext/string/output_safety.rb +34 -38
- data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -0
- data/lib/active_support/core_ext/string/strip.rb +4 -5
- data/lib/active_support/core_ext/string/zones.rb +4 -2
- data/lib/active_support/core_ext/string.rb +15 -13
- data/lib/active_support/core_ext/time/acts_like.rb +3 -1
- data/lib/active_support/core_ext/time/calculations.rb +85 -51
- data/lib/active_support/core_ext/time/compatibility.rb +4 -2
- data/lib/active_support/core_ext/time/conversions.rb +20 -13
- data/lib/active_support/core_ext/time/zones.rb +41 -7
- data/lib/active_support/core_ext/time.rb +7 -6
- data/lib/active_support/core_ext/uri.rb +6 -8
- data/lib/active_support/core_ext.rb +3 -1
- data/lib/active_support/current_attributes.rb +195 -0
- data/lib/active_support/dependencies/autoload.rb +2 -0
- data/lib/active_support/dependencies/interlock.rb +57 -0
- data/lib/active_support/dependencies.rb +152 -161
- data/lib/active_support/deprecation/behaviors.rb +44 -11
- data/lib/active_support/deprecation/constant_accessor.rb +52 -0
- data/lib/active_support/deprecation/instance_delegator.rb +17 -2
- data/lib/active_support/deprecation/method_wrappers.rb +66 -20
- data/lib/active_support/deprecation/proxy_wrappers.rb +56 -28
- data/lib/active_support/deprecation/reporting.rb +32 -12
- data/lib/active_support/deprecation.rb +12 -9
- data/lib/active_support/descendants_tracker.rb +2 -0
- data/lib/active_support/digest.rb +20 -0
- data/lib/active_support/duration/iso8601_parser.rb +125 -0
- data/lib/active_support/duration/iso8601_serializer.rb +55 -0
- data/lib/active_support/duration.rb +307 -35
- data/lib/active_support/encrypted_configuration.rb +49 -0
- data/lib/active_support/encrypted_file.rb +99 -0
- data/lib/active_support/evented_file_update_checker.rb +205 -0
- data/lib/active_support/execution_wrapper.rb +128 -0
- data/lib/active_support/executor.rb +8 -0
- data/lib/active_support/file_update_checker.rb +63 -37
- data/lib/active_support/gem_version.rb +6 -4
- data/lib/active_support/gzip.rb +7 -5
- data/lib/active_support/hash_with_indifferent_access.rb +123 -28
- data/lib/active_support/i18n.rb +8 -6
- data/lib/active_support/i18n_railtie.rb +37 -13
- data/lib/active_support/inflections.rb +13 -11
- data/lib/active_support/inflector/inflections.rb +61 -12
- data/lib/active_support/inflector/methods.rb +163 -136
- data/lib/active_support/inflector/transliterate.rb +48 -27
- data/lib/active_support/inflector.rb +7 -5
- data/lib/active_support/json/decoding.rb +16 -13
- data/lib/active_support/json/encoding.rb +11 -58
- data/lib/active_support/json.rb +4 -2
- data/lib/active_support/key_generator.rb +25 -25
- data/lib/active_support/lazy_load_hooks.rb +50 -20
- data/lib/active_support/locale/en.yml +2 -0
- data/lib/active_support/log_subscriber/test_helper.rb +14 -12
- data/lib/active_support/log_subscriber.rb +13 -10
- data/lib/active_support/logger.rb +8 -7
- data/lib/active_support/logger_silence.rb +6 -4
- data/lib/active_support/logger_thread_safe_level.rb +7 -5
- data/lib/active_support/message_encryptor.rb +168 -53
- data/lib/active_support/message_verifier.rb +150 -17
- data/lib/active_support/messages/metadata.rb +71 -0
- data/lib/active_support/messages/rotation_configuration.rb +22 -0
- data/lib/active_support/messages/rotator.rb +56 -0
- data/lib/active_support/multibyte/chars.rb +36 -23
- data/lib/active_support/multibyte/unicode.rb +100 -96
- data/lib/active_support/multibyte.rb +4 -2
- data/lib/active_support/notifications/fanout.rb +11 -9
- data/lib/active_support/notifications/instrumenter.rb +27 -7
- data/lib/active_support/notifications.rb +11 -7
- data/lib/active_support/number_helper/number_converter.rb +13 -11
- data/lib/active_support/number_helper/number_to_currency_converter.rb +9 -9
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +9 -3
- data/lib/active_support/number_helper/number_to_human_converter.rb +11 -9
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +9 -8
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +13 -4
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +23 -56
- data/lib/active_support/number_helper/rounding_helper.rb +66 -0
- data/lib/active_support/number_helper.rb +94 -68
- data/lib/active_support/option_merger.rb +3 -1
- data/lib/active_support/ordered_hash.rb +6 -4
- data/lib/active_support/ordered_options.rb +23 -5
- data/lib/active_support/per_thread_registry.rb +9 -4
- data/lib/active_support/proxy_object.rb +2 -0
- data/lib/active_support/rails.rb +16 -8
- data/lib/active_support/railtie.rb +43 -9
- data/lib/active_support/reloader.rb +131 -0
- data/lib/active_support/rescuable.rb +108 -53
- data/lib/active_support/security_utils.rb +15 -11
- data/lib/active_support/string_inquirer.rb +11 -3
- data/lib/active_support/subscriber.rb +21 -16
- data/lib/active_support/tagged_logging.rb +14 -11
- data/lib/active_support/test_case.rb +19 -47
- data/lib/active_support/testing/assertions.rb +137 -20
- data/lib/active_support/testing/autorun.rb +4 -2
- data/lib/active_support/testing/constant_lookup.rb +2 -1
- data/lib/active_support/testing/declarative.rb +3 -1
- data/lib/active_support/testing/deprecation.rb +14 -10
- data/lib/active_support/testing/file_fixtures.rb +36 -0
- data/lib/active_support/testing/isolation.rb +34 -25
- data/lib/active_support/testing/method_call_assertions.rb +43 -0
- data/lib/active_support/testing/setup_and_teardown.rb +13 -8
- data/lib/active_support/testing/stream.rb +44 -0
- data/lib/active_support/testing/tagged_logging.rb +3 -1
- data/lib/active_support/testing/time_helpers.rb +81 -15
- data/lib/active_support/time.rb +14 -12
- data/lib/active_support/time_with_zone.rb +169 -39
- data/lib/active_support/values/time_zone.rb +196 -61
- data/lib/active_support/values/unicode_tables.dat +0 -0
- data/lib/active_support/version.rb +3 -1
- data/lib/active_support/xml_mini/jdom.rb +116 -114
- data/lib/active_support/xml_mini/libxml.rb +16 -13
- data/lib/active_support/xml_mini/libxmlsax.rb +15 -14
- data/lib/active_support/xml_mini/nokogiri.rb +14 -12
- data/lib/active_support/xml_mini/nokogirisax.rb +14 -13
- data/lib/active_support/xml_mini/rexml.rb +11 -9
- data/lib/active_support/xml_mini.rb +37 -37
- data/lib/active_support.rb +12 -11
- metadata +54 -24
- data/lib/active_support/concurrency/latch.rb +0 -27
- data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +0 -16
- data/lib/active_support/core_ext/class/delegating_attributes.rb +0 -45
- data/lib/active_support/core_ext/date_time/zones.rb +0 -6
- data/lib/active_support/core_ext/kernel/debugger.rb +0 -10
- data/lib/active_support/core_ext/module/method_transplanting.rb +0 -13
- data/lib/active_support/core_ext/module/qualified_const.rb +0 -52
- data/lib/active_support/core_ext/object/itself.rb +0 -15
- data/lib/active_support/core_ext/struct.rb +0 -6
- data/lib/active_support/core_ext/thread.rb +0 -86
- data/lib/active_support/core_ext/time/marshal.rb +0 -30
@@ -1,6 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/core_ext/object/duplicable"
|
4
|
+
require "active_support/core_ext/string/inflections"
|
5
|
+
require "active_support/per_thread_registry"
|
4
6
|
|
5
7
|
module ActiveSupport
|
6
8
|
module Cache
|
@@ -9,7 +11,7 @@ module ActiveSupport
|
|
9
11
|
# duration of a block. Repeated calls to the cache for the same key will hit the
|
10
12
|
# in-memory cache for faster access.
|
11
13
|
module LocalCache
|
12
|
-
autoload :Middleware,
|
14
|
+
autoload :Middleware, "active_support/cache/strategy/local_cache_middleware"
|
13
15
|
|
14
16
|
# Class for storing and registering the local caches.
|
15
17
|
class LocalCacheRegistry # :nodoc:
|
@@ -39,7 +41,7 @@ module ActiveSupport
|
|
39
41
|
@data = {}
|
40
42
|
end
|
41
43
|
|
42
|
-
# Don't allow synchronizing since it isn't thread safe
|
44
|
+
# Don't allow synchronizing since it isn't thread safe.
|
43
45
|
def synchronize # :nodoc:
|
44
46
|
yield
|
45
47
|
end
|
@@ -52,6 +54,17 @@ module ActiveSupport
|
|
52
54
|
@data[key]
|
53
55
|
end
|
54
56
|
|
57
|
+
def read_multi_entries(keys, options)
|
58
|
+
values = {}
|
59
|
+
|
60
|
+
keys.each do |name|
|
61
|
+
entry = read_entry(name, options)
|
62
|
+
values[name] = entry.value if entry
|
63
|
+
end
|
64
|
+
|
65
|
+
values
|
66
|
+
end
|
67
|
+
|
55
68
|
def write_entry(key, value, options)
|
56
69
|
@data[key] = value
|
57
70
|
true
|
@@ -60,12 +73,17 @@ module ActiveSupport
|
|
60
73
|
def delete_entry(key, options)
|
61
74
|
!!@data.delete(key)
|
62
75
|
end
|
76
|
+
|
77
|
+
def fetch_entry(key, options = nil) # :nodoc:
|
78
|
+
@data.fetch(key) { @data[key] = yield }
|
79
|
+
end
|
63
80
|
end
|
64
81
|
|
65
82
|
# Use a local cache for the duration of block.
|
66
83
|
def with_local_cache
|
67
84
|
use_temporary_local_cache(LocalStore.new) { yield }
|
68
85
|
end
|
86
|
+
|
69
87
|
# Middleware class can be inserted as a Rack handler to be local cache for the
|
70
88
|
# duration of request.
|
71
89
|
def middleware
|
@@ -75,67 +93,82 @@ module ActiveSupport
|
|
75
93
|
end
|
76
94
|
|
77
95
|
def clear(options = nil) # :nodoc:
|
78
|
-
|
96
|
+
return super unless cache = local_cache
|
97
|
+
cache.clear(options)
|
79
98
|
super
|
80
99
|
end
|
81
100
|
|
82
101
|
def cleanup(options = nil) # :nodoc:
|
83
|
-
|
102
|
+
return super unless cache = local_cache
|
103
|
+
cache.clear
|
84
104
|
super
|
85
105
|
end
|
86
106
|
|
87
107
|
def increment(name, amount = 1, options = nil) # :nodoc:
|
88
|
-
|
89
|
-
|
108
|
+
return super unless local_cache
|
109
|
+
value = bypass_local_cache { super }
|
110
|
+
write_cache_value(name, value, options)
|
90
111
|
value
|
91
112
|
end
|
92
113
|
|
93
114
|
def decrement(name, amount = 1, options = nil) # :nodoc:
|
94
|
-
|
95
|
-
|
115
|
+
return super unless local_cache
|
116
|
+
value = bypass_local_cache { super }
|
117
|
+
write_cache_value(name, value, options)
|
96
118
|
value
|
97
119
|
end
|
98
120
|
|
99
|
-
|
100
|
-
def read_entry(key, options)
|
101
|
-
if local_cache
|
102
|
-
|
103
|
-
unless entry
|
104
|
-
entry = super
|
105
|
-
local_cache.write_entry(key, entry, options)
|
106
|
-
end
|
107
|
-
entry
|
121
|
+
private
|
122
|
+
def read_entry(key, options)
|
123
|
+
if cache = local_cache
|
124
|
+
cache.fetch_entry(key) { super }
|
108
125
|
else
|
109
126
|
super
|
110
127
|
end
|
111
128
|
end
|
112
129
|
|
113
|
-
def
|
114
|
-
|
130
|
+
def read_multi_entries(keys, options)
|
131
|
+
return super unless local_cache
|
132
|
+
|
133
|
+
local_entries = local_cache.read_multi_entries(keys, options)
|
134
|
+
missed_keys = keys - local_entries.keys
|
135
|
+
|
136
|
+
if missed_keys.any?
|
137
|
+
local_entries.merge!(super(missed_keys, options))
|
138
|
+
else
|
139
|
+
local_entries
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def write_entry(key, entry, options)
|
144
|
+
if options[:unless_exist]
|
145
|
+
local_cache.delete_entry(key, options) if local_cache
|
146
|
+
else
|
147
|
+
local_cache.write_entry(key, entry, options) if local_cache
|
148
|
+
end
|
149
|
+
|
115
150
|
super
|
116
151
|
end
|
117
152
|
|
118
|
-
def delete_entry(key, options)
|
153
|
+
def delete_entry(key, options)
|
119
154
|
local_cache.delete_entry(key, options) if local_cache
|
120
155
|
super
|
121
156
|
end
|
122
157
|
|
123
|
-
def
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
158
|
+
def write_cache_value(name, value, options)
|
159
|
+
name = normalize_key(name, options)
|
160
|
+
cache = local_cache
|
161
|
+
cache.mute do
|
162
|
+
if value
|
163
|
+
cache.write(name, value, options)
|
164
|
+
else
|
165
|
+
cache.delete(name, options)
|
131
166
|
end
|
132
167
|
end
|
133
168
|
end
|
134
169
|
|
135
|
-
private
|
136
|
-
|
137
170
|
def local_cache_key
|
138
|
-
@local_cache_key ||= "#{self.class.name.underscore}_local_cache_#{object_id}".gsub(/[\/-]/,
|
171
|
+
@local_cache_key ||= "#{self.class.name.underscore}_local_cache_#{object_id}".gsub(/[\/-]/, "_").to_sym
|
139
172
|
end
|
140
173
|
|
141
174
|
def local_cache
|
@@ -1,11 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rack/body_proxy"
|
4
|
+
require "rack/utils"
|
3
5
|
|
4
6
|
module ActiveSupport
|
5
7
|
module Cache
|
6
8
|
module Strategy
|
7
9
|
module LocalCache
|
8
|
-
|
9
10
|
#--
|
10
11
|
# This class wraps up local storage for middlewares. Only the middleware method should
|
11
12
|
# construct them.
|
@@ -13,9 +14,9 @@ module ActiveSupport
|
|
13
14
|
attr_reader :name, :local_cache_key
|
14
15
|
|
15
16
|
def initialize(name, local_cache_key)
|
16
|
-
@name
|
17
|
+
@name = name
|
17
18
|
@local_cache_key = local_cache_key
|
18
|
-
@app
|
19
|
+
@app = nil
|
19
20
|
end
|
20
21
|
|
21
22
|
def new(app)
|
@@ -29,13 +30,13 @@ module ActiveSupport
|
|
29
30
|
response[2] = ::Rack::BodyProxy.new(response[2]) do
|
30
31
|
LocalCacheRegistry.set_cache_for(local_cache_key, nil)
|
31
32
|
end
|
33
|
+
cleanup_on_body_close = true
|
32
34
|
response
|
33
35
|
rescue Rack::Utils::InvalidParameterError
|
34
|
-
LocalCacheRegistry.set_cache_for(local_cache_key, nil)
|
35
36
|
[400, {}, []]
|
36
|
-
|
37
|
-
LocalCacheRegistry.set_cache_for(local_cache_key, nil)
|
38
|
-
|
37
|
+
ensure
|
38
|
+
LocalCacheRegistry.set_cache_for(local_cache_key, nil) unless
|
39
|
+
cleanup_on_body_close
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|