Skip to content

@saazip/cache-core

Sources: packages/sdk/package.json | packages/sdk/src/index.ts

The public package published as @saazip/cache-core for embedded library-first adoption.

  • the main embedded cache API
  • remember/get/getWithMetadata primitives with stale-while-revalidate support
  • re-exported contracts, domain, and metric helpers
  • caching should stay close to the consuming backend instead of becoming a remote service
  • you want one stable package boundary for cache behavior
import { createCacheCore } from "@saazip/cache-core";
const cache = createCacheCore({
namespace: { service: 'billing-api', domain: 'plans' },
tenantId: "tenant_demo",
});
const value = await cache.remember(
['catalog', 'current'],
async () => ({ plans: ['starter', 'pro'] }),
{ tags: ['plans'], ttlSeconds: 60 },
);
  • Package name: @saazip/cache-core
  • Workspace path: packages/sdk
  • None
  • which reads are cached, how keys are chosen, and when invalidation should happen
  • your product-specific tag strategy and cache policy decisions
  • build: tsc -p tsconfig.json
  • typecheck: tsc --noEmit -p tsconfig.json
  • lint: biome check src package.json tsconfig.json