activesupport 6.0.0 → 6.0.3

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.

Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +90 -2
  3. data/README.rdoc +1 -1
  4. data/lib/active_support/backtrace_cleaner.rb +0 -1
  5. data/lib/active_support/cache.rb +29 -28
  6. data/lib/active_support/cache/file_store.rb +7 -8
  7. data/lib/active_support/cache/mem_cache_store.rb +8 -8
  8. data/lib/active_support/cache/memory_store.rb +8 -7
  9. data/lib/active_support/cache/null_store.rb +3 -3
  10. data/lib/active_support/cache/redis_cache_store.rb +8 -8
  11. data/lib/active_support/cache/strategy/local_cache.rb +23 -23
  12. data/lib/active_support/callbacks.rb +0 -3
  13. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +18 -0
  14. data/lib/active_support/concurrency/share_lock.rb +0 -1
  15. data/lib/active_support/core_ext/array/conversions.rb +5 -5
  16. data/lib/active_support/core_ext/date_and_time/zones.rb +0 -1
  17. data/lib/active_support/core_ext/date_time/conversions.rb +0 -1
  18. data/lib/active_support/core_ext/hash/conversions.rb +1 -1
  19. data/lib/active_support/core_ext/module/delegation.rb +8 -1
  20. data/lib/active_support/core_ext/module/introspection.rb +1 -0
  21. data/lib/active_support/core_ext/object/try.rb +2 -0
  22. data/lib/active_support/core_ext/range/compare_range.rb +9 -3
  23. data/lib/active_support/core_ext/range/each.rb +0 -1
  24. data/lib/active_support/core_ext/range/include_time_with_zone.rb +2 -2
  25. data/lib/active_support/core_ext/string/output_safety.rb +2 -1
  26. data/lib/active_support/dependencies.rb +0 -2
  27. data/lib/active_support/dependencies/zeitwerk_integration.rb +9 -2
  28. data/lib/active_support/deprecation/method_wrappers.rb +12 -6
  29. data/lib/active_support/deprecation/proxy_wrappers.rb +5 -1
  30. data/lib/active_support/descendants_tracker.rb +0 -1
  31. data/lib/active_support/duration.rb +15 -13
  32. data/lib/active_support/duration/iso8601_parser.rb +0 -1
  33. data/lib/active_support/duration/iso8601_serializer.rb +0 -1
  34. data/lib/active_support/encrypted_file.rb +1 -1
  35. data/lib/active_support/evented_file_update_checker.rb +0 -1
  36. data/lib/active_support/file_update_checker.rb +0 -1
  37. data/lib/active_support/gem_version.rb +1 -1
  38. data/lib/active_support/i18n_railtie.rb +4 -0
  39. data/lib/active_support/inflector/inflections.rb +0 -1
  40. data/lib/active_support/inflector/methods.rb +1 -2
  41. data/lib/active_support/json/decoding.rb +0 -1
  42. data/lib/active_support/lazy_load_hooks.rb +0 -1
  43. data/lib/active_support/locale/en.rb +4 -2
  44. data/lib/active_support/log_subscriber.rb +0 -1
  45. data/lib/active_support/logger.rb +1 -1
  46. data/lib/active_support/message_encryptor.rb +1 -1
  47. data/lib/active_support/message_verifier.rb +2 -2
  48. data/lib/active_support/messages/metadata.rb +3 -2
  49. data/lib/active_support/messages/rotator.rb +4 -4
  50. data/lib/active_support/multibyte/chars.rb +1 -2
  51. data/lib/active_support/multibyte/unicode.rb +0 -1
  52. data/lib/active_support/notifications/instrumenter.rb +4 -4
  53. data/lib/active_support/number_helper.rb +4 -0
  54. data/lib/active_support/number_helper/number_converter.rb +4 -5
  55. data/lib/active_support/number_helper/number_to_currency_converter.rb +7 -8
  56. data/lib/active_support/number_helper/number_to_delimited_converter.rb +0 -1
  57. data/lib/active_support/number_helper/number_to_human_converter.rb +0 -1
  58. data/lib/active_support/number_helper/number_to_human_size_converter.rb +0 -1
  59. data/lib/active_support/number_helper/number_to_phone_converter.rb +0 -1
  60. data/lib/active_support/number_helper/number_to_rounded_converter.rb +0 -1
  61. data/lib/active_support/option_merger.rb +21 -3
  62. data/lib/active_support/ordered_hash.rb +1 -1
  63. data/lib/active_support/ordered_options.rb +5 -1
  64. data/lib/active_support/parameter_filter.rb +1 -2
  65. data/lib/active_support/string_inquirer.rb +0 -1
  66. data/lib/active_support/testing/parallelization.rb +8 -2
  67. data/lib/active_support/testing/stream.rb +0 -1
  68. data/lib/active_support/testing/time_helpers.rb +0 -2
  69. data/lib/active_support/xml_mini.rb +0 -1
  70. data/lib/active_support/xml_mini/jdom.rb +0 -1
  71. metadata +12 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20a0c971abcca4b9dabec6e28ef72c919a6ffaed5e35b29e4c3e2f359e99341b
4
- data.tar.gz: e42089cf6ad412ef2fcf772afd6a8e010944b57fde1833c9d495dfb9c5eb3da5
3
+ metadata.gz: 2ecaab093a95934f616bf961543b5b996df6129688365994127affb9b0f7b18b
4
+ data.tar.gz: 4e200bc745348e0a45f8e52a570376d3da4316f1d68751f109e09c19eaa963b8
5
5
  SHA512:
6
- metadata.gz: 8ff0c3e5feb9bb0dfcf5e0c95b4fb5bb8c6a30d2e276101c8ec949db9ad0895c397dc33cc1a99ec2636b45b3169a495eb8c852440956d8500d95399548b70948
7
- data.tar.gz: fdf6945ee23e487a9b0403fcac9a7b51551900a6338a4caeb34970656033fd1e62c00eda5d463fb6fc3d0ad880470c7544f2a2108bcc5809520a8436d1bdf360
6
+ metadata.gz: a5a2525304c76190c7b8bb5a00f4a1ac9b96ab896f867b3f6db26ffd6e05ae389348947fee02e6c8ba53568f5e85425e69de51cd6d022732952266d0670de3bf
7
+ data.tar.gz: 92efcfa7ba82f282c64c42233de3e46aced59e113a4ec2f4d516e2f8cc104838f93cd2e7814a05b4088d600289b719ef4f518b38a93db43210e78667743173f3
@@ -1,3 +1,90 @@
1
+ ## Rails 6.0.3 (May 06, 2020) ##
2
+
3
+ * `Array#to_sentence` no longer returns a frozen string.
4
+
5
+ Before:
6
+
7
+ ['one', 'two'].to_sentence.frozen?
8
+ # => true
9
+
10
+ After:
11
+
12
+ ['one', 'two'].to_sentence.frozen?
13
+ # => false
14
+
15
+ *Nicolas Dular*
16
+
17
+ * Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
18
+ `ActiveSupport.parse_json_times = true`.
19
+
20
+ *Christian Gregg*
21
+
22
+
23
+ ## Rails 6.0.2.2 (March 19, 2020) ##
24
+
25
+ * No changes.
26
+
27
+
28
+ ## Rails 6.0.2.1 (December 18, 2019) ##
29
+
30
+ * No changes.
31
+
32
+
33
+ ## Rails 6.0.2 (December 13, 2019) ##
34
+
35
+ * Eager load translations during initialization.
36
+
37
+ *Diego Plentz*
38
+
39
+ * Use per-thread CPU time clock on `ActiveSupport::Notifications`.
40
+
41
+ *George Claghorn*
42
+
43
+
44
+ ## Rails 6.0.1 (November 5, 2019) ##
45
+
46
+ * `ActiveSupport::SafeBuffer` supports `Enumerator` methods.
47
+
48
+ *Shugo Maeda*
49
+
50
+ * The Redis cache store fails gracefully when the server returns a "max number
51
+ of clients reached" error.
52
+
53
+ *Brandon Medenwald*
54
+
55
+ * Fixed that mutating a value returned by a memory cache store would
56
+ unexpectedly change the cached value.
57
+
58
+ *Jonathan Hyman*
59
+
60
+ * The default inflectors in `zeitwerk` mode support overrides:
61
+
62
+ ```ruby
63
+ # config/initializers/zeitwerk.rb
64
+ Rails.autoloaders.each do |autoloader|
65
+ autoloader.inflector.inflect(
66
+ "html_parser" => "HTMLParser",
67
+ "ssl_error" => "SSLError"
68
+ )
69
+ end
70
+ ```
71
+
72
+ That way, you can tweak how individual basenames are inflected without touching Active Support inflection rules, which are global. These inflectors fallback to `String#camelize`, so existing inflection rules are still taken into account for non-overridden basenames.
73
+
74
+ Please, check the [autoloading guide for `zeitwerk` mode](https://guides.rubyonrails.org/v6.0/autoloading_and_reloading_constants.html#customizing-inflections) if you prefer not to depend on `String#camelize` at all.
75
+
76
+ *Xavier Noria*
77
+
78
+ * Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
79
+ and endless range targets.
80
+
81
+ *Allen Hsu*, *Andrew Hodgkinson*
82
+
83
+ * Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
84
+
85
+ *Iain Beeston*
86
+
87
+
1
88
  ## Rails 6.0.0 (August 16, 2019) ##
2
89
 
3
90
  * Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
@@ -49,6 +136,7 @@
49
136
 
50
137
  *Aaron Lipman*
51
138
 
139
+
52
140
  ## Rails 6.0.0.rc2 (July 22, 2019) ##
53
141
 
54
142
  * `truncate` would return the original string if it was too short to be truncated
@@ -287,7 +375,7 @@
287
375
 
288
376
  *Jan Habermann*, *Xavier Noria*
289
377
 
290
- * Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSuppport::Multibyte::Unicode#unpack_graphemes(string)`
378
+ * Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSupport::Multibyte::Unicode#unpack_graphemes(string)`
291
379
  in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
292
380
 
293
381
  *Francesco Rodríguez*
@@ -305,7 +393,7 @@
305
393
 
306
394
  *Edouard Chin*
307
395
 
308
- * Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSuppport::Multibyte::Chars#normalize`
396
+ * Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSupport::Multibyte::Chars#normalize`
309
397
  in favor of `String#unicode_normalize`
310
398
 
311
399
  *Francesco Rodríguez*
@@ -37,4 +37,4 @@ Bug reports for the Ruby on Rails project can be filed here:
37
37
 
38
38
  Feature requests should be discussed on the rails-core mailing list here:
39
39
 
40
- * https://groups.google.com/forum/?fromgroups#!forum/rubyonrails-core
40
+ * https://discuss.rubyonrails.org/c/rubyonrails-core
@@ -85,7 +85,6 @@ module ActiveSupport
85
85
  end
86
86
 
87
87
  private
88
-
89
88
  FORMATTED_GEMS_PATTERN = /\A[^\/]+ \([\w.]+\) /
90
89
 
91
90
  def add_gem_filter
@@ -52,12 +52,13 @@ module ActiveSupport
52
52
  #
53
53
  # ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new)
54
54
  # # => returns MyOwnCacheStore.new
55
- def lookup_store(*store_option)
56
- store, *parameters = *Array.wrap(store_option).flatten
57
-
55
+ def lookup_store(store = nil, *parameters)
58
56
  case store
59
57
  when Symbol
60
- retrieve_store_class(store).new(*parameters)
58
+ options = parameters.extract_options!
59
+ retrieve_store_class(store).new(*parameters, **options)
60
+ when Array
61
+ lookup_store(*store)
61
62
  when nil
62
63
  ActiveSupport::Cache::MemoryStore.new
63
64
  else
@@ -318,7 +319,7 @@ module ActiveSupport
318
319
 
319
320
  entry = nil
320
321
  instrument(:read, name, options) do |payload|
321
- cached_entry = read_entry(key, options) unless options[:force]
322
+ cached_entry = read_entry(key, **options) unless options[:force]
322
323
  entry = handle_expired_entry(cached_entry, key, options)
323
324
  entry = nil if entry && entry.mismatched?(normalize_version(name, options))
324
325
  payload[:super_operation] = :fetch if payload
@@ -326,9 +327,9 @@ module ActiveSupport
326
327
  end
327
328
 
328
329
  if entry
329
- get_entry_value(entry, name, options)
330
+ get_entry_value(entry, name, **options)
330
331
  else
331
- save_block_result_to_cache(name, options) { |_name| yield _name }
332
+ save_block_result_to_cache(name, **options) { |_name| yield _name }
332
333
  end
333
334
  elsif options && options[:force]
334
335
  raise ArgumentError, "Missing block: Calling `Cache#fetch` with `force: true` requires a block."
@@ -352,11 +353,11 @@ module ActiveSupport
352
353
  version = normalize_version(name, options)
353
354
 
354
355
  instrument(:read, name, options) do |payload|
355
- entry = read_entry(key, options)
356
+ entry = read_entry(key, **options)
356
357
 
357
358
  if entry
358
359
  if entry.expired?
359
- delete_entry(key, options)
360
+ delete_entry(key, **options)
360
361
  payload[:hit] = false if payload
361
362
  nil
362
363
  elsif entry.mismatched?(version)
@@ -384,7 +385,7 @@ module ActiveSupport
384
385
  options = merged_options(options)
385
386
 
386
387
  instrument :read_multi, names, options do |payload|
387
- read_multi_entries(names, options).tap do |results|
388
+ read_multi_entries(names, **options).tap do |results|
388
389
  payload[:hits] = results.keys
389
390
  end
390
391
  end
@@ -396,10 +397,10 @@ module ActiveSupport
396
397
 
397
398
  instrument :write_multi, hash, options do |payload|
398
399
  entries = hash.each_with_object({}) do |(name, value), memo|
399
- memo[normalize_key(name, options)] = Entry.new(value, options.merge(version: normalize_version(name, options)))
400
+ memo[normalize_key(name, options)] = Entry.new(value, **options.merge(version: normalize_version(name, options)))
400
401
  end
401
402
 
402
- write_multi_entries entries, options
403
+ write_multi_entries entries, **options
403
404
  end
404
405
  end
405
406
 
@@ -438,7 +439,7 @@ module ActiveSupport
438
439
  options = merged_options(options)
439
440
 
440
441
  instrument :read_multi, names, options do |payload|
441
- reads = read_multi_entries(names, options)
442
+ reads = read_multi_entries(names, **options)
442
443
  writes = {}
443
444
  ordered = names.each_with_object({}) do |name, hash|
444
445
  hash[name] = reads.fetch(name) { writes[name] = yield(name) }
@@ -447,7 +448,7 @@ module ActiveSupport
447
448
  payload[:hits] = reads.keys
448
449
  payload[:super_operation] = :fetch_multi
449
450
 
450
- write_multi(writes, options)
451
+ write_multi(writes, **options)
451
452
 
452
453
  ordered
453
454
  end
@@ -460,8 +461,8 @@ module ActiveSupport
460
461
  options = merged_options(options)
461
462
 
462
463
  instrument(:write, name, options) do
463
- entry = Entry.new(value, options.merge(version: normalize_version(name, options)))
464
- write_entry(normalize_key(name, options), entry, options)
464
+ entry = Entry.new(value, **options.merge(version: normalize_version(name, options)))
465
+ write_entry(normalize_key(name, options), entry, **options)
465
466
  end
466
467
  end
467
468
 
@@ -472,7 +473,7 @@ module ActiveSupport
472
473
  options = merged_options(options)
473
474
 
474
475
  instrument(:delete, name) do
475
- delete_entry(normalize_key(name, options), options)
476
+ delete_entry(normalize_key(name, options), **options)
476
477
  end
477
478
  end
478
479
 
@@ -483,7 +484,7 @@ module ActiveSupport
483
484
  options = merged_options(options)
484
485
 
485
486
  instrument(:exist?, name) do
486
- entry = read_entry(normalize_key(name, options), options)
487
+ entry = read_entry(normalize_key(name, options), **options)
487
488
  (entry && !entry.expired? && !entry.mismatched?(normalize_version(name, options))) || false
488
489
  end
489
490
  end
@@ -556,28 +557,28 @@ module ActiveSupport
556
557
 
557
558
  # Reads an entry from the cache implementation. Subclasses must implement
558
559
  # this method.
559
- def read_entry(key, options)
560
+ def read_entry(key, **options)
560
561
  raise NotImplementedError.new
561
562
  end
562
563
 
563
564
  # Writes an entry to the cache implementation. Subclasses must implement
564
565
  # this method.
565
- def write_entry(key, entry, options)
566
+ def write_entry(key, entry, **options)
566
567
  raise NotImplementedError.new
567
568
  end
568
569
 
569
570
  # Reads multiple entries from the cache implementation. Subclasses MAY
570
571
  # implement this method.
571
- def read_multi_entries(names, options)
572
+ def read_multi_entries(names, **options)
572
573
  results = {}
573
574
  names.each do |name|
574
575
  key = normalize_key(name, options)
575
576
  version = normalize_version(name, options)
576
- entry = read_entry(key, options)
577
+ entry = read_entry(key, **options)
577
578
 
578
579
  if entry
579
580
  if entry.expired?
580
- delete_entry(key, options)
581
+ delete_entry(key, **options)
581
582
  elsif entry.mismatched?(version)
582
583
  # Skip mismatched versions
583
584
  else
@@ -590,15 +591,15 @@ module ActiveSupport
590
591
 
591
592
  # Writes multiple entries to the cache implementation. Subclasses MAY
592
593
  # implement this method.
593
- def write_multi_entries(hash, options)
594
+ def write_multi_entries(hash, **options)
594
595
  hash.each do |key, entry|
595
- write_entry key, entry, options
596
+ write_entry key, entry, **options
596
597
  end
597
598
  end
598
599
 
599
600
  # Deletes an entry from the cache implementation. Subclasses must
600
601
  # implement this method.
601
- def delete_entry(key, options)
602
+ def delete_entry(key, **options)
602
603
  raise NotImplementedError.new
603
604
  end
604
605
 
@@ -699,7 +700,7 @@ module ActiveSupport
699
700
  entry.expires_at = Time.now + race_ttl
700
701
  write_entry(key, entry, expires_in: race_ttl * 2)
701
702
  else
702
- delete_entry(key, options)
703
+ delete_entry(key, **options)
703
704
  end
704
705
  entry = nil
705
706
  end
@@ -711,7 +712,7 @@ module ActiveSupport
711
712
  entry.value
712
713
  end
713
714
 
714
- def save_block_result_to_cache(name, options)
715
+ def save_block_result_to_cache(name, **options)
715
716
  result = instrument(:generate, name, options) do
716
717
  yield(name)
717
718
  end
@@ -36,15 +36,15 @@ module ActiveSupport
36
36
  def clear(options = nil)
37
37
  root_dirs = (Dir.children(cache_path) - GITKEEP_FILES)
38
38
  FileUtils.rm_r(root_dirs.collect { |f| File.join(cache_path, f) })
39
- rescue Errno::ENOENT
39
+ rescue Errno::ENOENT, Errno::ENOTEMPTY
40
40
  end
41
41
 
42
42
  # Preemptively iterates through all stored keys and removes the ones which have expired.
43
43
  def cleanup(options = nil)
44
44
  options = merged_options(options)
45
45
  search_dir(cache_path) do |fname|
46
- entry = read_entry(fname, options)
47
- delete_entry(fname, options) if entry && entry.expired?
46
+ entry = read_entry(fname, **options)
47
+ delete_entry(fname, **options) if entry && entry.expired?
48
48
  end
49
49
  end
50
50
 
@@ -66,14 +66,13 @@ module ActiveSupport
66
66
  matcher = key_matcher(matcher, options)
67
67
  search_dir(cache_path) do |path|
68
68
  key = file_path_key(path)
69
- delete_entry(path, options) if key.match(matcher)
69
+ delete_entry(path, **options) if key.match(matcher)
70
70
  end
71
71
  end
72
72
  end
73
73
 
74
74
  private
75
-
76
- def read_entry(key, options)
75
+ def read_entry(key, **options)
77
76
  if File.exist?(key)
78
77
  File.open(key) { |f| Marshal.load(f) }
79
78
  end
@@ -82,14 +81,14 @@ module ActiveSupport
82
81
  nil
83
82
  end
84
83
 
85
- def write_entry(key, entry, options)
84
+ def write_entry(key, entry, **options)
86
85
  return false if options[:unless_exist] && File.exist?(key)
87
86
  ensure_cache_path(File.dirname(key))
88
87
  File.atomic_write(key, cache_path) { |f| Marshal.dump(entry, f) }
89
88
  true
90
89
  end
91
90
 
92
- def delete_entry(key, options)
91
+ def delete_entry(key, **options)
93
92
  if File.exist?(key)
94
93
  begin
95
94
  File.delete(key)
@@ -28,7 +28,7 @@ module ActiveSupport
28
28
  # Provide support for raw values in the local cache strategy.
29
29
  module LocalCacheWithRaw # :nodoc:
30
30
  private
31
- def read_entry(key, options)
31
+ def read_entry(key, **options)
32
32
  entry = super
33
33
  if options[:raw] && local_cache && entry
34
34
  entry = deserialize_entry(entry.value)
@@ -36,11 +36,11 @@ module ActiveSupport
36
36
  entry
37
37
  end
38
38
 
39
- def write_entry(key, entry, options)
39
+ def write_entry(key, entry, **options)
40
40
  if options[:raw] && local_cache
41
41
  raw_entry = Entry.new(entry.value.to_s)
42
42
  raw_entry.expires_at = entry.expires_at
43
- super(key, raw_entry, options)
43
+ super(key, raw_entry, **options)
44
44
  else
45
45
  super
46
46
  end
@@ -142,12 +142,12 @@ module ActiveSupport
142
142
 
143
143
  private
144
144
  # Read an entry from the cache.
145
- def read_entry(key, options)
145
+ def read_entry(key, **options)
146
146
  rescue_error_with(nil) { deserialize_entry(@data.with { |c| c.get(key, options) }) }
147
147
  end
148
148
 
149
149
  # Write an entry to the cache.
150
- def write_entry(key, entry, options)
150
+ def write_entry(key, entry, **options)
151
151
  method = options && options[:unless_exist] ? :add : :set
152
152
  value = options[:raw] ? entry.value.to_s : entry
153
153
  expires_in = options[:expires_in].to_i
@@ -156,12 +156,12 @@ module ActiveSupport
156
156
  expires_in += 5.minutes
157
157
  end
158
158
  rescue_error_with false do
159
- @data.with { |c| c.send(method, key, value, expires_in, options) }
159
+ @data.with { |c| c.send(method, key, value, expires_in, **options) }
160
160
  end
161
161
  end
162
162
 
163
163
  # Reads multiple entries from the cache implementation.
164
- def read_multi_entries(names, options)
164
+ def read_multi_entries(names, **options)
165
165
  keys_to_names = Hash[names.map { |name| [normalize_key(name, options), name] }]
166
166
 
167
167
  raw_values = @data.with { |c| c.get_multi(keys_to_names.keys) }
@@ -179,7 +179,7 @@ module ActiveSupport
179
179
  end
180
180
 
181
181
  # Delete an entry from the cache.
182
- def delete_entry(key, options)
182
+ def delete_entry(key, **options)
183
183
  rescue_error_with(false) { @data.with { |c| c.delete(key) } }
184
184
  end
185
185
 
@@ -51,7 +51,7 @@ module ActiveSupport
51
51
  keys = synchronize { @data.keys }
52
52
  keys.each do |key|
53
53
  entry = @data[key]
54
- delete_entry(key, options) if entry && entry.expired?
54
+ delete_entry(key, **options) if entry && entry.expired?
55
55
  end
56
56
  end
57
57
  end
@@ -67,7 +67,7 @@ module ActiveSupport
67
67
  instrument(:prune, target_size, from: @cache_size) do
68
68
  keys = synchronize { @key_access.keys.sort { |a, b| @key_access[a].to_f <=> @key_access[b].to_f } }
69
69
  keys.each do |key|
70
- delete_entry(key, options)
70
+ delete_entry(key, **options)
71
71
  return if @cache_size <= target_size || (max_time && Concurrent.monotonic_time - start_time > max_time)
72
72
  end
73
73
  end
@@ -98,7 +98,7 @@ module ActiveSupport
98
98
  matcher = key_matcher(matcher, options)
99
99
  keys = synchronize { @data.keys }
100
100
  keys.each do |key|
101
- delete_entry(key, options) if key.match(matcher)
101
+ delete_entry(key, **options) if key.match(matcher)
102
102
  end
103
103
  end
104
104
  end
@@ -114,17 +114,18 @@ module ActiveSupport
114
114
  end
115
115
 
116
116
  private
117
-
118
117
  PER_ENTRY_OVERHEAD = 240
119
118
 
120
119
  def cached_size(key, entry)
121
120
  key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
122
121
  end
123
122
 
124
- def read_entry(key, options)
123
+ def read_entry(key, **options)
125
124
  entry = @data[key]
126
125
  synchronize do
127
126
  if entry
127
+ entry = entry.dup
128
+ entry.dup_value!
128
129
  @key_access[key] = Time.now.to_f
129
130
  else
130
131
  @key_access.delete(key)
@@ -133,7 +134,7 @@ module ActiveSupport
133
134
  entry
134
135
  end
135
136
 
136
- def write_entry(key, entry, options)
137
+ def write_entry(key, entry, **options)
137
138
  entry.dup_value!
138
139
  synchronize do
139
140
  old_entry = @data[key]
@@ -150,7 +151,7 @@ module ActiveSupport
150
151
  end
151
152
  end
152
153
 
153
- def delete_entry(key, options)
154
+ def delete_entry(key, **options)
154
155
  synchronize do
155
156
  @key_access.delete(key)
156
157
  entry = @data.delete(key)