aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache
diff options
context:
space:
mode:
authorfatkodima <fatkodima123@gmail.com>2018-02-05 00:35:17 +0200
committerJeremy Daer <jeremydaer@gmail.com>2018-02-04 17:16:27 -0800
commit08aa8afd24e65525757c6cb9ef2af60b5984c6ac (patch)
treef3b15dc88afe2ac6398004994604d10e5c35007d /activesupport/lib/active_support/cache
parent5d1999547d81edb07c0ce9149023b1bcd5de8a57 (diff)
downloadrails-08aa8afd24e65525757c6cb9ef2af60b5984c6ac.tar.gz
rails-08aa8afd24e65525757c6cb9ef2af60b5984c6ac.tar.bz2
rails-08aa8afd24e65525757c6cb9ef2af60b5984c6ac.zip
RedisCacheStore: fix `#write_multi` mset serialization
Closes #31886 Fixes #31884
Diffstat (limited to 'activesupport/lib/active_support/cache')
-rw-r--r--activesupport/lib/active_support/cache/redis_cache_store.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/cache/redis_cache_store.rb b/activesupport/lib/active_support/cache/redis_cache_store.rb
index 1de98dcd6c..b5a2a2a636 100644
--- a/activesupport/lib/active_support/cache/redis_cache_store.rb
+++ b/activesupport/lib/active_support/cache/redis_cache_store.rb
@@ -17,6 +17,7 @@ end
require "digest/sha2"
require "active_support/core_ext/marshal"
+require "active_support/core_ext/hash/transform_values"
module ActiveSupport
module Cache
@@ -360,7 +361,13 @@ module ActiveSupport
if entries.any?
if mset_capable? && expires_in.nil?
failsafe :write_multi_entries do
- redis.mapped_mset(entries)
+ serialized_entries = if options[:raw]
+ entries.transform_values { |e| e.value.to_s }
+ else
+ entries.transform_values { |e| serialize_entry(e) }
+ end
+
+ redis.mapped_mset(serialized_entries)
end
else
super