A DDEV add-on that provides DragonflyDB as a Redis-compatible in-memory data store for local development.
DragonflyDB is a modern replacement for Redis that is fully compatible with the Redis API while offering better performance and lower memory usage for many workloads.
ddev add-on get ddev-dragonfly
ddev restartAfter installation, the DragonflyDB service is available at dragonfly:6379 from within the DDEV network.
| Command | Description |
|---|---|
ddev redis-cli |
Run redis-cli commands against DragonflyDB |
ddev dragonfly-flush |
Flush all keys (FLUSHALL ASYNC) |
ddev redis-cli PING # Returns PONG
ddev redis-cli SET foo bar # Set a key
ddev redis-cli GET foo # Get a key
ddev redis-cli INFO # Server info
ddev redis-cli DBSIZE # Number of keys
ddev dragonfly-flush # Flush all keysOverride defaults by setting environment variables in .ddev/config.yaml:
web_environment:
- DRAGONFLY_DOCKER_IMAGE=docker.dragonflydb.io/dragonflydb/dragonfly:v1.25.5
- DRAGONFLY_HOSTNAME=dragonfly| Variable | Default | Description |
|---|---|---|
DRAGONFLY_DOCKER_IMAGE |
docker.dragonflydb.io/dragonflydb/dragonfly:v1.38.1 |
Docker image for DragonflyDB |
DRAGONFLY_HOSTNAME |
dragonfly |
Hostname for the DragonflyDB container |
The DragonflyDB container starts with these flags:
--port=6379— listen port--maxmemory=512mb— memory limit--cache_mode=true— automatic eviction of least-recently-used keys when memory limit is reached--proactor_threads=2— number of I/O threads (suitable for local dev)
To customize flags, create a docker-compose.dragonfly_extra.yaml override:
services:
dragonfly:
command: dragonfly --port=6379 --maxmemory=1gb --cache_mode=true --proactor_threads=4For Drupal 9+ projects, the add-on automatically:
- Copies
settings.ddev.dragonfly.phptosites/default/ - Appends an include line to
settings.php
This configures Drupal's Redis module to use DragonflyDB as the cache backend. You need the Redis module installed and the PhpRedis PHP extension enabled (included in DDEV by default).
| Feature | ddev-redis | ddev-dragonfly |
|---|---|---|
| Backend | Redis | DragonflyDB |
| Redis API compatible | Yes | Yes |
| Memory efficiency | Standard | Better for many workloads |
| Multi-threaded | No (single-threaded) | Yes |
| Cluster mode | Optional | Not needed (multi-threaded) |
| Configuration | Config files | Command-line flags |
Both add-ons use the same Drupal Redis module and PhpRedis extension. You can switch between them by removing one and installing the other.
Note: Do not run both ddev-redis and ddev-dragonfly simultaneously — they serve the same purpose and Drupal settings will conflict.
ddev add-on remove dragonfly
ddev restartThis removes the DragonflyDB container and cleans up settings.ddev.dragonfly.php from your Drupal site if it contains the #ddev-generated marker.