npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mohamedhabibwork/cachekit

v0.1.2

Published

Provider-first, runtime-portable TypeScript caching.

Readme

CacheKit

Provider-first, runtime-portable TypeScript caching for Node.js 20+, Bun, and Deno.

CacheKit gives applications one deliberate cache contract without hiding provider differences. Core imports have no provider SDK dependencies; provider entrypoints load their SDK only when you use them.

Install

npm install @mohamedhabibwork/cachekit

Quick start

import { createCache } from '@mohamedhabibwork/cachekit';

const cache = await createCache({
  type: 'memory',
  namespace: 'catalog:v1',
  defaultTtl: '10m',
});

await cache.set('product:42', { id: 42, name: 'Keyboard' }, {
  ttl: '5m',
  tags: ['products', 'product:42'],
});

const product = await cache.get<{ id: number; name: string }>('product:42');

Supported in 0.1

| Provider | Import | Status | | --- | --- | --- | | Memory | @mohamedhabibwork/cachekit or /memory | Complete in-process provider: TTL, SWR, tags, local locks, codecs. | | Redis protocol | @mohamedhabibwork/cachekit/redis | Optional redis peer dependency; works with Redis-compatible endpoints. Tags and namespace clear deliberately report unsupported. | | Custom | @mohamedhabibwork/cachekit | Register an application provider with the public contract. |

The architecture plan tracks planned profiles and embedded drivers. They are not published as empty entrypoints: importing a package path always means a usable implementation exists.

Redis

npm install @mohamedhabibwork/cachekit redis
import { createRedisCache } from '@mohamedhabibwork/cachekit/redis';

const cache = await createRedisCache({
  url: process.env.REDIS_URL,
  namespace: 'catalog:v1',
  defaultTtl: '10m',
});

await cache.set('product:42', { id: 42 }, { ttl: '5m', native: { NX: true } });

The generic factory also supports Redis directly: createCache({ type: 'redis', url: process.env.REDIS_URL }). The optional SDK is still loaded only when that provider is created.

You may inject a compatible client with sendCommand() instead of letting CacheKit create one. If redis is missing, the provider throws CacheDependencyMissingError with its installation command.

Semantics

  • A cache miss is undefined; null is cacheable.
  • ttl is the fresh period; staleTtl is an additional stale window. get() returns fresh values only; get(..., { allowStale: true }) can return in-window stale data.
  • getOrSet() deduplicates concurrent loads within a process. With a stale entry it returns the stale value while one local caller refreshes it, unless serveStale: false.
  • Built-in codecs are json (default), text, and bytes. Custom codecs must have a name, encode, and decode.
  • Keys and tags reject control characters. Namespaces use an unambiguous internal separator.
  • Inspect cache.capabilities before relying on a non-portable operation such as distributed locks or tags.

Development

npm ci
npm run check

npm run check lints, typechecks, tests, and produces dual ESM/CJS output. The CI workflow covers Node 20/22/24 plus Bun and Deno smoke tests. Pushing a v* tag runs the provenance-enabled publish workflow; see publishing.

Guides

License

MIT