Getting Started

What is Gorgon.js?

Gorgon is a lightweight 9.1kb (2.8kb gzipped) and simple caching library focused on simplifying your caching system and reduce overall load in your application both on the frontend and the backend.

Gorgon will cache the result of any Async function or Promise in memory out of the box while also preventing concurrent calls from fast requests.

Key Features


import Gorgon from '@gorgonjs/gorgon';

const getTODO = async (id: number) => {
  return Gorgon.get(`todo/${id}`, async () => {
    return fetch(`https://jsonplaceholder.typicode.com/todos/${id}`)
      .then(response => response.json());
  }, 60 * 1000); // 1 minute

const todo1 = await getTODO(1); // fetches from API

const todo2 = await getTODO(2); // fetches from API

const todo3 = await getTODO(1); // fetches from cache