lib/zache.rb in zache-0.11.0 vs lib/zache.rb in zache-0.12.0

- old
+ new

@@ -163,9 +163,18 @@ # Remove all keys from the cache. def remove_all synchronized { @hash = {} } end + # Remove all keys that match the block. + def remove_by + synchronized do + @hash.keys.each do |k| + @hash.delete(k) if yield(k) + end + end + end + # Remove keys that are expired. def clean synchronized { @hash.delete_if { |_key, value| expired?(value) } } end