lru_redux icon indicating copy to clipboard operation
lru_redux copied to clipboard

LruRedux::TTL::ThreadSafeCache.delete does not return the deleted item as docs say

Open adam-hampton-sp opened this issue 1 year ago • 0 comments

The LruRedux::TTL::ThreadSafeCache.delete method does not return the deleted item as docs say. It looks like the code returns an expiration time float value and not the deleted item.

Easy enough to work around, but we need to either update the README docs or change the library's behavior.

Example reproduction:

my_cache = LruRedux::TTL::ThreadSafeCache.new(8, 300)
my_cache["a"] = "This is string A"
my_cache["b"] = "This is string B"

result_obj = my_cache.delete "a"
puts "result_obj: #{result_obj} #{result_obj.class}"

This produces output like:

result_obj: 1697043228.1882849 Float

adam-hampton-sp avatar Oct 11 '23 16:10 adam-hampton-sp