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

@arikajs/cache

v0.0.4

Published

Simple, fast, and driver-based caching system for the ArikaJS framework.

Readme

Arika Cache

@arikajs/cache provides a simple, fast, and driver-based caching system for the ArikaJS framework.

It allows applications to store frequently accessed data in memory or external stores to improve performance and reduce repeated computation or database queries.


✨ Features

  • Unified cache API: Consistent interface across all drivers
  • Multiple cache stores: Support for various storage backends
  • Driver-based architecture: Pluggable storage drivers
  • In-memory cache (v1): High-performance default storage
  • TTL (time-to-live) support: Automatic expiration of cached items
  • Cache tagging: Logical grouping of cache keys (planned)
  • TypeScript-first design: Strong typing for keys and values

📦 Installation

npm install @arikajs/cache
# or
yarn add @arikajs/cache
# or
pnpm add @arikajs/cache

🚀 Basic Usage

import { Cache } from '@arikajs/cache';

// Store a value for 60 seconds
await Cache.put('users.count', 150, 60);

// Retrieve a value
const count = await Cache.get('users.count');

🧹 Cache Helpers

// Get an item, or execute the callback and store the result if it doesn't exist
await Cache.remember('settings', 300, async () => {
  return loadSettings();
});

⚙️ Configuration

export default {
  default: process.env.CACHE_STORE || 'database',

  stores: {
    memory: {
      driver: 'memory',
    },

    database: {
      driver: 'database',
      table: 'cache',
      connection: null,
    },
  },

  prefix: process.env.CACHE_PREFIX || 'arika_cache',
};

| Driver | Status | Description | | :--- | :--- | :--- | | Memory | ✅ Supported | Default in-memory ephemeral storage | | Database | ✅ Supported | Persistent cache using your database | | Redis | ✅ Supported | High-performance distributed cache (Standalone, Sentinel, Cluster) |


🏎️ Redis Cache Setup

The Redis driver supports Standalone, Sentinel, and Cluster modes.

1. Install Redis Package

npm install ioredis

2. Configure Environment

Add Redis settings to your .env file:

CACHE_STORE=redis

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
REDIS_DB=0

3. Advanced Redis Configuration

ArikaJS supports Sentinel and Cluster modes. Configure these in config/cache.ts:

Sentinel Mode

redis: {
  driver: 'redis',
  connection: 'default',
  mode: 'sentinel',
  nodes: [
    { host: '127.0.0.1', port: 26379 },
    { host: '127.0.0.1', port: 26380 },
  ],
  name: 'mymaster',
},

Cluster Mode

redis: {
  driver: 'redis',
  mode: 'cluster',
  nodes: [
    { host: '127.0.0.1', port: 7000 },
    { host: '127.0.0.1', port: 7001 },
  ],
},

🛠 Database Cache Setup

To use the database driver, you need to create the cache table migration:

arika cache:table
arika migrate

🔗 Integration

  • @arikajs/http → response caching
  • @arikajs/view → view fragments
  • @arikajs/queue → cached jobs
  • @arikajs/auth → session storage

🧠 Architecture (High Level)

cache/
├── src/
│   ├── CacheManager.ts
│   ├── Repository.ts
│   ├── Drivers/
│   │   ├── MemoryDriver.ts
│   │   ├── DatabaseDriver.ts
│   │   └── RedisDriver.ts
│   ├── Contracts/
│   │   └── Store.ts
│   └── index.ts
├── tests/
├── package.json
├── tsconfig.json
├── README.md
└── LICENSE

📄 License

@arikajs/cache is open-source software licensed under the MIT License.


🧭 Philosophy

"Fast data wins."