test/test_zache.rb in zache-0.11.0 vs test/test_zache.rb in zache-0.12.0
- old
+ new
@@ -83,9 +83,18 @@
cache.remove(:hey)
assert(cache.exists?(:hey) == false)
assert(cache.exists?(:wey) == true)
end
+ def test_remove_by_block
+ cache = Zache.new
+ cache.get('first') { Random.rand }
+ cache.get('second') { Random.rand }
+ cache.remove_by { |k| k == 'first' }
+ assert(cache.exists?('first') == false)
+ assert(cache.exists?('second') == true)
+ end
+
def test_remove_key_with_sync_false
cache = Zache.new(sync: false)
cache.get(:hey) { Random.rand }
cache.get(:wey) { Random.rand }
assert(cache.exists?(:hey) == true)