When the clear() method is called on a LRUCache, concurrently running get() and put() calls may throw exceptions.
The get() method may throw an exception because it tries to
self.clock[pos]['ref'] = True
but the clear() method is only slowly rebuilding the self.clock list. This results in index out of bounds.
put() may except when it is searching for a place to put an item. put() walks along self.clock and can experience index out of bounds just like the get() method.
When the clear() method is called on a LRUCache, concurrently running get() and put() calls may throw exceptions.
The get() method may throw an exception because it tries to self.clock[pos]['ref'] = True but the clear() method is only slowly rebuilding the self.clock list. This results in index out of bounds.
put() may except when it is searching for a place to put an item. put() walks along self.clock and can experience index out of bounds just like the get() method.