LRUCache.jl
LRUCache.jl copied to clipboard
Allow the use `ReentrantLock` instead of `SpinLock`
In the current implementation, if a user needs to hold the cache's lock over multiple gets/sets, one cannot use the cache's internal lock since it is a SpinLock
and blocks.
Suggestion: Use a ReentrantLock
or provide the user the option to use such a lock instead of a SpinLock
. Moreover, implement
Base.lock(lru::LRU) = lock(lru.lock)
(likewise for unlock
) to allow users taking that lock.