DEV Community

Stipe Grbić
Stipe Grbić

Posted on • Originally published at stipe.xyz on

1 1

Be careful with cache

There’s a well known saying that goes like this: There are only two hard things in Computer Science: cache invalidation and naming things*. This is a post about the first one.

Today I experienced a cache invalidation issue where I was presented with cached instead of fresh data which was different. This prevented me from fixing an issue which only my colleague discovered and for a minute we were confused with what was happening.

This just remembered me to be careful next time when I’m thinking about caching things. It’s extremely important that you know when to invalidate cache. If you don’t determine that moment correctly you are about to put a nasty bug in your product and frustrate your users.

* https://martinfowler.com/bliki/TwoHardThings.html

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay