Method: Zache#clean
- Defined in:
- lib/zache.rb
#clean ⇒ Integer
Remove keys that are expired. This cleans up the cache by removing all keys where the lifetime has been exceeded.
251 252 253 254 255 256 257 |
# File 'lib/zache.rb', line 251 def clean synchronize_all do size_before = @hash.size @hash.delete_if { |key, _value| expired?(key) } size_before - @hash.size end end |