Comment by JamesSwift
Comment by JamesSwift a day ago
Looks good. Id suggest making your `get` wait to acquire the lock until needed. eg instead of
@lock.synchronize do
entry = @store[key]
return nil unless entry
...
you can do entry = @store[key]
return nil unless entry
@lock.synchronize do
entry = @store[key]
And similarly for other codepaths
Does the memory model guarantee that double-check locking will be correct? I don't actually know for ruby.