Observed since 20 Oct, 22:00 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Cache helpers with TTL + tag invalidation. Wraps Next.js `unstable_cache` and `cache()` patterns; in-memory store for non-Next runtimes.
TTL + tag-invalidation cache with single-flight dedupe. Fixes the classic N+1: 10 components asking for the same user concurrently → 1 backend call.
import { makeMemoryCache, makeKey } from "@021.is/spine-cache";
const cache = makeMemoryCache();
async function getUser(id: string) {
return cache.fetch(
makeKey("user", id),
async () => db.user.findUniqueOrThrow({ where: { id } }),
{ ttlMs: 60_000, tags: ["user", `user:${id}`] },
);
}
// Invalidate by key or by tag
cache.invalidate(makeKey("user", id));
cache.invalidateTag("user"); // wipes ALL user entries
Without dedupe: 10 concurrent components each call getUser("u_1") → 10 DB hits. With dedupe: 1 promise shared → 1 DB hit.
makeKey("user", id, "lang", "en") → "user:u_1:lang:en" (readable in dashboards)cache.size() for observabilitycache.clear() for testsunstable_cache directlyYou can combine them — unstable_cache for cross-request, spine-cache for in-request dedupe. spine-cache is process-local (no Redis), zero deps.
Download counts and popularity will appear here as the collector receives them.
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:00 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:740a267c7fc331e413fd9cead0f741326636cb9be5b2678b9d9c3bbdc37166a9