Remove keys from local_cache in RedisCacheStore#delete_matched
Fixes #38627
This commit is contained in:
parent
ad0b10f6c3
commit
1edc61dff0
@ -1,3 +1,9 @@
|
||||
* Remove entries from local cache on `RedisCacheStore#delete_matched`
|
||||
|
||||
Fixes #38627
|
||||
|
||||
*ojab*
|
||||
|
||||
* Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
|
||||
`OpenSSL.fixed_length_secure_compare`, if available.
|
||||
|
||||
|
@ -107,6 +107,12 @@ def cleanup(**options) # :nodoc:
|
||||
super
|
||||
end
|
||||
|
||||
def delete_matched(matcher, options = nil) # :nodoc:
|
||||
return super unless cache = local_cache
|
||||
cache.clear
|
||||
super
|
||||
end
|
||||
|
||||
def increment(name, amount = 1, **options) # :nodoc:
|
||||
return super unless local_cache
|
||||
value = bypass_local_cache { super }
|
||||
|
@ -102,6 +102,24 @@ def test_local_cache_of_delete
|
||||
end
|
||||
end
|
||||
|
||||
def test_local_cache_of_delete_matched
|
||||
begin
|
||||
@cache.delete_matched("*")
|
||||
rescue NotImplementedError
|
||||
skip
|
||||
end
|
||||
|
||||
@cache.with_local_cache do
|
||||
@cache.write("foo", "bar")
|
||||
@cache.write("fop", "bar")
|
||||
@cache.write("bar", "foo")
|
||||
@cache.delete_matched("fo*")
|
||||
assert_not @cache.exist?("foo")
|
||||
assert_not @cache.exist?("fop")
|
||||
assert_equal "foo", @cache.read("bar")
|
||||
end
|
||||
end
|
||||
|
||||
def test_local_cache_of_exist
|
||||
@cache.with_local_cache do
|
||||
@cache.write("foo", "bar")
|
||||
|
Loading…
Reference in New Issue
Block a user