bunRedis adapter wraps Bun’s native Redis client for persistent caching. This is optimized for Bun runtime.
Bun Redis is part of Bun’s standard library. No additional dependencies required if using Bun.
Basic Usage
Redis Connection
Adapter Configuration
With Schema Serialization
Differences from ioredis
ThebunRedis adapter uses Bun’s native Redis client which:
- Faster: Native implementation in Bun
- No dependencies: Built into Bun runtime
- Same API: Drop-in replacement for
ioredisadapter
Tiered Caching
Complete Example
Type Signature
SET Command Implementation
Bun’s Redis client usessend() for the SET command with TTL:
Error Handling
Redis errors are converted to Effect failures:Like the ioredis adapter,
bunRedis uses Effect.orDie for Redis operations - errors will crash the fiber unless explicitly caught.