2.7 KiB
2.7 KiB
name, description, metadata
| name | description | metadata | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| redis | Redis in-memory cache with persistence and pub/sub |
|
Redis Skill
Installs and configures Redis in-memory data store for caching, pub/sub messaging, and session storage.
Features
- In-memory key-value store
- RDB + AOF persistence
- Pub/sub messaging
- Optional authentication
- Memory limit with eviction policy
- Auto-registers with Caddy if domain set
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
REDIS_PORT |
6379 |
Redis port |
REDIS_PASSWORD |
(none) | Optional authentication password |
REDIS_MAXMEMORY |
100mb |
Memory limit |
REDIS_MAXMEMORY_POLICY |
allkeys-lru |
Eviction policy when memory limit reached |
REDIS_DATA_DIR |
/data/redis |
Persistence directory |
REDIS_APPENDONLY |
yes |
Enable AOF persistence |
REDIS_SAVE |
900 1 300 10 60 10000 |
RDB save intervals |
REDIS_DOMAIN |
(none) | Domain for Caddy auto-config |
Output Variables
After starting, the skill exports:
| Variable | Example |
|---|---|
REDIS_URL |
redis://:password@localhost:6379 |
Usage
As a dependency
metadata:
vibestack:
requires:
- redis
Connection
# Connect with redis-cli
redis-cli -p 6379
# With authentication
redis-cli -p 6379 -a "$REDIS_PASSWORD"
# From application
REDIS_URL=redis://localhost:6379
# or with auth
REDIS_URL=redis://:password@localhost:6379
Common Operations
# Set a key
redis-cli SET mykey "Hello"
# Get a key
redis-cli GET mykey
# Pub/sub
redis-cli SUBSCRIBE mychannel
redis-cli PUBLISH mychannel "Hello subscribers!"
# Check memory usage
redis-cli INFO memory
Persistence
Redis is configured with both RDB snapshots and AOF (Append Only File):
- RDB: Point-in-time snapshots at configured intervals
- AOF: Log of all write operations for durability
Data is stored in REDIS_DATA_DIR (default: /data/redis).
Memory Management
When REDIS_MAXMEMORY is reached, the REDIS_MAXMEMORY_POLICY determines behavior:
| Policy | Description |
|---|---|
allkeys-lru |
Evict least recently used keys (default) |
volatile-lru |
Evict LRU keys with TTL set |
allkeys-random |
Evict random keys |
noeviction |
Return errors on write |
Caddy Integration
If the caddy skill is present and REDIS_DOMAIN is set, Redis will be accessible via HTTPS (useful for Redis Insight or other GUI tools).
Security
For production use:
- Always set
REDIS_PASSWORD - Restrict network access
- Use TLS for external connections