What is Quell?
Quell is an easy-to-use, lightweight JavaScript library providing a client- and server-side caching solution for GraphQL.
π§ What does Quell do?
Quellβs schema-governed, type-level normalization algorithm deconstructs GraphQL query responses into individual graph nodes to be cached separately as constant-time-readable key-value pairs, with references to connected nodes.
Subsequent GraphQL requests are then checked against the cached data store, allowing Quell to only request the data it needs by dynamically reformulating a new query for whatβs missing.
Query responses are then merged with the data present in the cache and a full response is returned seamlessly.
Features
- Client-side caching utilizing sessionStorage
- Server-side caching utilizing a configurable Redis in-memory data store
- Automatic unique cache key generation
- Partial and exact match query caching
- Programmatic rebuilding of GraphQL queries to fetch only the minimum data necessary to complete the response based upon current cache contents
Installation
Quell is divided up into two npm packages:
-
- Download @quell/client from npm in your terminal with
npm i @quell/client
- Download @quell/server from npm in your terminal with
npm i @quell/server
Installing and Connecting a Redis Server
If not already installed on your server, install Redis.
- Mac-Homebrew:
- At the terminal, type
brew install redis
- After installation completes, type
redis-server
- Your server should now have a Redis database connection open (note the port on which it is listening)
- Linux or non-Homebrew:
-
- Download appropriate version of Redis from redis.io/download
- Follow installation instructions
- Once Redis is successfully installed, follow instructions to open a Redis database connection (note the port on which it is listening)
Usage Notes
- Currently, Quell can only cache query-type requests without aliases, fragments, variables, or directives. Quell will still process these other requests, but will not cache the responses.
Documentation
Sources:
https://andrei-cabrera.medium.com/introducing-quell-caching-solution-for-graphql-4579bdb4e231
0 Comments