Obsidian 4.0.0 Launch: Deno GraphQL caching solution


Performant Caching in Mind

Request Time = Cache Check (Hit Rate) + Service Call Time (1 — Hit Rate) + Cache Write (1- Hit Rate)

Problem and Challenge

Cache invalidation

Cache eviction

Solution and implementation


Restructured server-side caching logic

Figure 1: Overall server-side cache logic flow diagram

Functional flow diagram

Figure 2: Redesigned function flow of server-side caching logic which incorporates cache invalidation

Normalization Algorithm

Response Transformation

Figure 3: Obsidian flattens the original GraphQL response object (top left) into normalized objects (top right), and transforms it into an object of references (bottom right) to be stored in cache.

Cache Invalidation

  1. In the case of a read query, the GraphQL response is transformed into an object of reference and cached with its query string as the Redis hash. Furthermore, each reference object is cached with its reference string as the Redis hash.
  2. In the case of a delete mutation, the references are abstracted from the GraphQL response and invalidated from cache through deletion.
  3. In the case of either a create or update mutation, each reference object is cached with its reference string as the Redis hash. If the reference already exists, it is overwritten with the updated value.

Cache eviction

Getting Started




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Start Here

Reliable Web Application Development Company in Vietnam

Simple search bar for React on Rails

What is DevOps?

Richmond ready for move from Congress to West Wing

Spring Boot Admin SetUp

This week in #Scala (Mar 16, 2020)

Top 5 programming languages in 2022 (LASTEST UPDATE).

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Michael Chin

Michael Chin

More from Medium

Building a ready for production microservice in NestJS: Writing an authorization microservice —…

Nest JS Advanced Course Coming up

Single repository, multiple NestJS projects

Setup Project and Fastify Platform — NestJs with Passport #01