Merge pull request #48662 from skipkayhil/hm-fix-memcache-6-1-deprecation

Fix MemCacheStore not warning on 6.1 cache format
This commit is contained in:
Eileen M. Uchitelle 2023-07-06 09:10:51 -04:00 committed by GitHub
commit 1cbd88f918
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -224,6 +224,12 @@ module ActiveSupport
private
def default_coder
if Cache.format_version == 6.1
ActiveSupport.deprecator.warn <<~EOM
Support for `config.active_support.cache_format_version = 6.1` has been deprecated and will be removed in Rails 7.2.
Check the Rails upgrade guide at https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#new-activesupport-cache-serialization-format
for more information on how to upgrade.
EOM
Cache::SerializerWithFallback[:passthrough]
else
super

View File

@ -106,7 +106,11 @@ module CacheStoreFormatVersionBehavior
private
def with_format(format_version, &block)
ActiveSupport.deprecator.silence do
if format_version == 6.1
assert_deprecated(ActiveSupport.deprecator) do
ActiveSupport::Cache.with(format_version: format_version, &block)
end
else
ActiveSupport::Cache.with(format_version: format_version, &block)
end
end