DEV Community

Cover image for Cache Aside
Aniketh Deshpande
Aniketh Deshpande

Posted on

Cache Aside

Cache Aside or Lazy Loading is one of the cache write policies or strategies.

  • In cache aside method, the application is responsible for storing data into cache.
  • When the client sends request to the application, it looks for data in the cache.
  • If the data is found in the cache it is called as cache-hit. The data is fetched from cache and returned to client.
  • However, if the data is not found in the cache, also called as cache-miss, the application queries for data in the database, writes the data into cache and sends the response to the client.
  • Since we store data in cache only when it is necessary, this strategy is also called as Lazy-Loading.

Cache Aside - Write Strategy

Advantages:
  • The implementation is simple.
Disadvantages:
  • The response time can be slow when there is cache miss, because, it involves many io operations to fetch data from DB and store it in cache.

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

Top comments (0)

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

👋 Kindness is contagious

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

Okay