Comment

Comment by CuriousNinja

One of the examples on invalidating cache on write has the following code, which is buggy. If the DB call fails, then cache cache would have data that was never actually committed. Cache coherency is hard.

  def update_something_slow(thing_id, new_thing):
    my_cache.set_by_str(thing_id, new_thing)
    set_thing_in_a_database_layer(new_thing)

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton