CLOSE
Updated on 06 Dec, 20254 mins read 13 views

Where to Cache the Data

There are few different layers in system where caching can live. Each of which have their own trade-offs.

1 External Caching

External caching means storing cached data outside the application, in a separate system that multiple services can access.

In it we introduce a dedicated caching service like Redis or Memcached. It runs on its own server and manages its own memory and it's totally separate from our application and database.

The most common external caches are:

  • Redis
  • Memcached
  • Aerospike
  • CDN caches (Cloudflare, Akamai, Fastly)

external_cacching
Flow:

When application needs data, it first checks the cache. If the data is found there, that's a cache hit and it returns the data instantly. If it's not there we call that a cache miss and it has to fallback to the database, fetch the data and it stores a copy of that data back in the cache and returns it back to the client.

Buy Me A Coffee

Leave a comment

Your email address will not be published. Required fields are marked *

Your experience on this site will be improved by allowing cookies Cookie Policy