Official Redis driver with support for caching, pub/sub, and advanced data structures.
ostack add driver-redis
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');
// Simple cache with TTL
await redis.setex('session:123', 3600, JSON.stringify(sessionData));
// Get cached data
const cached = await redis.get('session:123');
// Subscribe to channel
redis.subscribe('notifications', (message) => {
console.log('Received:', message);
});
// Publish message
await redis.publish('notifications', 'Hello World');
MIT © ObjectStack Team