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

@argos-js/cache

v0.1.2

Published

Modular, runtime-agnostic caching suite for Argos-JS with Pulse CDC Near-Cache, Redis, ArgosDB Table and In-Memory drivers

Readme

@argos-js/cache

High-performance, modular, and runtime-agnostic caching suite for Argos-JS, featuring sub-millisecond In-Memory RAM reads (< 0.05ms) and instant reactive cache invalidation driven by ArgosDB Pulse CDC (argosdb-pulse).


Key Features

  • Runtime-Agnostic & Zero Addons: 100% pure TypeScript using standard Web APIs (Map, Uint8Array, TextEncoder, TextDecoder, crypto). Runs seamlessly across Node.js 18+, Bun, and Deno.
  • Pulse Near-Cache Driver (PulseNearCacheDriver):
    • L1 In-Memory RAM: Serves hot cache entries directly from process heap in microseconds without network hops.
    • Reactive CDC Invalidation: Subscribes to ArgosDB Pulse streams (cdc.<table_name>.*). When an UPDATE or DELETE occurs in the database, stale keys are purged from L1 cache in the exact same event cycle, completely solving the stale cache problem.
  • Pluggable Drivers:
    • pulse: Near-Cache combining L1 RAM with real-time CDC invalidation (default with ArgosDB).
    • memory: In-memory driver with configurable LRU eviction and TTL expiration.
    • redis: Pluggable Redis adapter with prefix and tag support (optional dependency, no runtime crash if unused).
    • argosdb: Distributed table-backed cache in ArgosDB (app_cache), sharing cache across cluster workers without deploying separate Redis infrastructure.
  • Batch Tag Invalidation: Group related cache keys by tags (e.g. ['users', 'tenant_123']) and purge them in a single call.
  • Fetch-Through (getOrSet): Transparent read-through pattern with automatic population and TTL configuration.

Installation

pnpm add @argos-js/cache

Configuration

Configure the active driver via code or environment variables:

# Driver selection: pulse | memory | redis | argosdb
CACHE_DRIVER=pulse

Initializing CacheManager

import { createCache } from '@argos-js/cache';

export const cache = createCache({
  driver: (process.env.CACHE_DRIVER as any) || 'pulse',
  prefix: 'argos_api:',
  defaultTtl: 300, // 5 minutes default TTL
  pulse: {
    listenCdc: true,
    watchedTables: ['auth_users', 'products'],
  },
});

Usage

1. Fetch-Through (getOrSet)

const user = await cache.getOrSet(`user:${userId}`, async () => {
  return await db.select().from(users).where(eq(users.id, userId)).first();
}, { ttl: 600 });

2. Manual Set & Get

// Store item with 60s TTL and tags
await cache.set('product:123', productData, {
  ttl: 60,
  tags: ['products', 'category_electronics'],
});

const product = await cache.get('product:123');

3. Invalidation by Tag

// Purges all products when catalog changes
await cache.invalidateByTag('products');

Near-Cache CDC Architecture

 ┌────────────────────────────────────────────────────────┐
 │                      Application                       │
 └──────────────────────────┬─────────────────────────────┘
                            │
            ┌───────────────┴───────────────┐
            ▼                               ▼
    [1] Fast Cache Read            [2] Cache Miss
       L1 RAM (< 0.05ms)              Database Query
            │                               │
            │                        ArgosDB Mutation
            │                               │
            │                               ▼
            │                     ArgosDB Pulse (WAL/CDC)
            │                               │
            │                  TCP Binary Stream (Port 8788)
            │                               │
            │                               ▼
            └──────── [3] Invalidate L1 ────┘
                   (Instant Purge on UPDATE/DELETE)

License

MIT © Argos-JS Team