🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@oncely/redis

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@oncely/redis

Redis storage adapter for oncely idempotency - works with ioredis

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

@oncely/redis

Redis storage adapter for oncely using ioredis.

npm version

Installation

npm install @oncely/core @oncely/redis ioredis

Quick Start

import { redis } from '@oncely/redis';
import { express as idempotent } from '@oncely/express';

// From environment variable (ONCELY_REDIS_URL)
app.post('/orders', idempotent({ storage: redis() }), handler);

Configuration

import { redis } from '@oncely/redis';

// From environment variable
const storage = redis();

// From URL (password in URL)
const storage = redis('redis://:password@localhost:6379');

// With options
const storage = redis({
  url: 'redis://localhost:6379',
  keyPrefix: 'myapp:idem:',
});

// With existing ioredis client
import Redis from 'ioredis';
const client = new Redis({ host: 'localhost', password: 'secret' });
const storage = redis({ client });

Environment Variables

VariableDescription
ONCELY_REDIS_URLRedis connection URL (e.g., redis://:password@host:6379)

Redis Cluster

import Redis from 'ioredis';
import { redis } from '@oncely/redis';

const cluster = new Redis.Cluster([
  { host: 'node1.example.com', port: 6379 },
  { host: 'node2.example.com', port: 6379 },
]);

const storage = redis({ client: cluster });

AWS ElastiCache

const storage = redis('redis://your-cluster.cache.amazonaws.com:6379');

Usage with Express

import { express as idempotent, configure } from '@oncely/express';
import { redis } from '@oncely/redis';

const idempotent = configure({
  storage: redis(),
  ttl: '1h',
});

app.post('/orders', idempotent(), orderHandler);
app.post('/payments', idempotent({ required: true }), paymentHandler);

Usage with Next.js

import { next } from '@oncely/next';
import { redis } from '@oncely/redis';

export const POST = next({ storage: redis() })(handler);

Key Prefix

All keys are prefixed with oncely: by default. Customize with:

const storage = redis({ keyPrefix: 'myapp:idem:' });

License

MIT

Keywords

idempotency

FAQs

Package last updated on 25 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts