Frontend System Design1 min readPremium

Understanding Normalized vs. Non-Normalized Cache

In a blogging application, caching plays a crucial role in performance and efficiency. Let’s explore the concepts of normalized and non-normalized cache using blog posts and their authors as an example. Apollo Client’s caching docs explain how its normalized cache works in practice.

Data from Server

Consider this sample data structure fetched from the server, featuring two posts by the same author, “Alice”:

{
  "posts": [
    {
      "id": "1",
      "title": "My First Post",
      "author": {
        "id": "a1",
        "name": "Alice"
      }
    },
    {
      "id": "2",
      "title": "Another Day, Another Post",
      "author": {
        "id": "a1",
        "name": "Alice"
      }
    }
  ]
}

Non-Normalized Cache

In a non-normalized cache, data is stored as received, without any alteration. Here’s... premium content.

Premium

Keep reading with Premium

Get the rest of this guide plus every premium question, solution, and system design deep dive.

  • All premium solutions
  • System design deep dives
  • Company-specific prep

4.9/5 from our users