lib/zache.rb in zache-0.9.0 vs lib/zache.rb in zache-0.10.0
- old
+ new
@@ -112,12 +112,12 @@
end
# Checks whether the value exists in the cache by the provided key. Returns
# TRUE if the value is here. If the key is already expired in the hash,
# it will be removed by this method and the result will be FALSE.
- def exists?(key)
+ def exists?(key, dirty: false)
rec = @hash[key]
- if key_expired?(key)
+ if key_expired?(key) && !dirty && !@dirty
@hash.delete(key)
rec = nil
end
!rec.nil?
end