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

@blackbirdjs/cache

v0.1.1

Published

An asynchronous, Promise-wrapped IndexedDB cache engine with native Redis-style TTL expiration mechanics.

Readme

@blackbirdjs/cache

An asynchronous, Promise-wrapped IndexedDB caching engine for modern browsers, featuring native Redis-style TTL (Time-To-Live) expiration mechanics.

Features

  • ⚡ Async/Await Ready: Bridges the native event-driven IndexedDB API into standard modern Promises.
  • ⏱️ Automatic Eviction: Self-cleaning architecture that purges expired keys from disk during read operations to save storage.
  • 📦 Zero Dependencies: Pure JavaScript implementation that runs completely client-side.
  • 🔒 High Capacity: Bypasses the strict 5MB quota limitation of localStorage to securely house gigabytes of structured objects.

Installation

npm install @blackbirdjs/cache

Usage

1. Initialization

Create an instance of the cache. If the database does not exist on the user's machine, the browser will configure it automatically on the fly.

import { BlackbirdCache } from '@blackbirdjs/cache';

const cache = new BlackbirdCache('MyApplicationCache', 'api_store');

2. Set with TTL (Redis-style Expiration)

You can save plain values, arrays, or deeply nested objects directly without manually calling JSON.stringify(). Pass an optional third parameter to set an expiration window in seconds.

// Permanent storage (survives page reloads indefinitely)
await cache.set('user:theme', 'dark');

// Expiring storage (automatically expires and deletes itself after 60 seconds)
const sessionToken = { token: 'xyz123', role: 'admin' };
await cache.set('user:session', sessionToken, 60);

3. Get with Auto-Eviction

Retrieve your cached object with standard asynchronous operations. If a key's expiration window has passed, the cache will instantly return null and silently delete the stale entry from the user's hard drive to free up space.

const session = await cache.get('user:session');

if (session) {
  console.log('Valid session found:', session.role);
} else {
  console.log('Session has expired or does not exist.');
}

4. Explicit Deletion

Manually remove any single key out of your storage database block instantly.

await cache.del('user:theme');

API Reference

new BlackbirdCache(databaseName, storeName)

  • databaseName (String): The browser IndexedDB file group name. Defaults to 'BlackbirdCacheDB'.
  • storeName (String): The underlying table/bucket layout name. Defaults to 'cache_store'.

set(key, value, ttlInSeconds)

  • key (String): The unique look-up string.
  • value (any): Any structural JavaScript data payload (Objects, Arrays, Booleans, etc.).
  • ttlInSeconds (Number): Optional. Time until data automatically expires.

get(key)

  • Returns a Promise resolving to the stored payload value, or null if the key is missing or expired.

del(key)

  • Returns a Promise resolving to true once the target entry is erased from disk.

License

Distributed under the Apache License 2.0. See LICENSE for details.