🔴

driver-redis

Official
driver

High-performance Redis driver for ObjectStack. Perfect for caching, session storage, and real-time applications.

ostack add driver-redis

Documentation

Redis Driver for ObjectStack

Official Redis driver with support for caching, pub/sub, and advanced data structures.

Features

  • ✅ Full Redis command support
  • ✅ Pub/Sub messaging
  • ✅ Cluster support
  • ✅ Redis Streams
  • ✅ Automatic reconnection

Installation

ostack add driver-redis

Quick Start

import { RedisDriver } from '@objectstack/driver-redis';

const redis = new RedisDriver({
  host: 'localhost',
  port: 6379
});

await redis.connect();
await redis.set('key', 'value');
const value = await redis.get('key');

Caching Example

// Simple cache with TTL
await redis.setex('session:123', 3600, JSON.stringify(sessionData));

// Get cached data
const cached = await redis.get('session:123');

Pub/Sub

// Subscribe to channel
redis.subscribe('notifications', (message) => {
  console.log('Received:', message);
});

// Publish message
await redis.publish('notifications', 'Hello World');

License

MIT © ObjectStack Team