Skip to content

Commit c36f877

Browse files
Merge pull request rails#49974 from fatkodima/fix-redis-write_multi-with-expires_in
Fix `RedisCacheStore#write_multi` with `:expires_in`
2 parents 4162b12 + 096201f commit c36f877

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

activesupport/lib/active_support/cache/redis_cache_store.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def delete_multi_entries(entries, **_options)
386386
end
387387

388388
# Nonstandard store provider API to write multiple values at once.
389-
def write_multi_entries(entries, expires_in: nil, race_condition_ttl: nil, **options)
389+
def write_multi_entries(entries, **options)
390390
return if entries.empty?
391391

392392
failsafe :write_multi_entries do

activesupport/test/cache/behaviors/cache_store_behavior.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ def test_write_multi_empty_hash
174174
assert @cache.write_multi({})
175175
end
176176

177+
def test_write_multi_expires_in
178+
key = SecureRandom.uuid
179+
@cache.write_multi({ key => 1 }, expires_in: 10)
180+
181+
travel(11.seconds) do
182+
assert_nil @cache.read(key)
183+
end
184+
end
185+
177186
def test_fetch_multi
178187
key = SecureRandom.uuid
179188
other_key = SecureRandom.uuid

0 commit comments

Comments
 (0)