Redis Cache
In-memory data store and cache
In-memory key-value store for caching, sessions, and real-time applications using Redis Alpine.
Docker Configuration
Image: redis:alpine
Ports: 6379:6379
Volume: damp-redis:/dataDAMP identifies the service using Docker labels. Container name is auto-generated by Docker.
Port Configuration
Default ports: 6379 (host) → 6379 (container)
If port 6379 is occupied on the host machine, DAMP automatically uses the next available port. Check the DAMP interface to see the actual port assigned.
Authentication
No authentication is configured for development environments.
Connection Information
From Host Machine (Windows)
Connect from your Windows host to the Redis service.
redis-cli -h localhost -p 6379
# Test connection
redis-cli -h localhost -p 6379 ping
# Returns: PONGConnection Details:
- Host:
localhost - Port:
6379(or actual port shown in DAMP) - Password: None
Connection String:
redis://localhost:6379From Project Containers
Connect from your DevContainers or other Docker containers to the Redis service.
Use the container name or ID shown in the DAMP interface.
# Using container name from DAMP
redis-cli -h [container-name]
# Test connection
redis-cli -h [container-name] ping
# Returns: PONGLaravel .env Configuration:
REDIS_HOST=[container-name]
REDIS_PORT=6379
REDIS_PASSWORD=nullReplace [container-name] with the actual container name displayed in DAMP.
Common Operations
Set and Get Values
redis-cli -h localhost
SET user:1:name "John Doe"
GET user:1:name
# With expiration (10 seconds)
SETEX session:abc123 10 "user_data"Laravel Cache Example
// Store cache for 1 hour
Cache::put('users', $users, 3600);
// Retrieve cached data
$users = Cache::get('users');Session Storage
// In config/session.php
'driver' => 'redis',
'connection' => 'default',Common Use Cases
- Caching frequently accessed data
- Fast session storage
- Real-time analytics counters
- Pub/Sub real-time messaging
- API rate limiting
Data Persistence
Data is periodically saved to the damp-redis volume for durability.