gorgon-cache

Installation
SKILL.md

Gorgon.js Caching Library

Gorgon is a lightweight (~4kb, ~1.3kb gzipped) TypeScript caching library for async functions. It works in both Node.js and browsers. Its key differentiator is automatic concurrency protection — multiple simultaneous requests for the same cache key are deduplicated, with all callers receiving the same result.

Installation

npm install @gorgonjs/gorgon
# or: pnpm add @gorgonjs/gorgon / yarn add @gorgonjs/gorgon

Core Concepts

  1. Cache key naming: Use the format cachetype/{id}/{sub-id} — this enables wildcard clearing (e.g. Gorgon.clear('user/*'))
  2. Concurrency protection: If 10 requests hit Gorgon.get('key', fn) simultaneously, fn only executes once. The other 9 wait and share the result.
  3. Errors are never cached: If the async function throws, all waiting callers get the error, but the next request retries fresh.
  4. Expiry options: milliseconds (60000), a Date object, false (cache forever), or omit for no expiry.

API Reference

Installs
3
GitHub Stars
11
First Seen
Mar 22, 2026
gorgon-cache — mikevalstar/gorgon