Comment

Comment by JamesSwift

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
parent JamesSwift 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton