https://github.com/dipakmdhrm/ddev-dragonfly
DDEV add-on for DragonflyDB — a Redis-compatible in-memory data store
https://github.com/dipakmdhrm/ddev-dragonfly
cache ddev ddev-get dragonfly dragonflydb redis
Last synced: 15 days ago
JSON representation
DDEV add-on for DragonflyDB — a Redis-compatible in-memory data store
- Host: GitHub
- URL: https://github.com/dipakmdhrm/ddev-dragonfly
- Owner: dipakmdhrm
- Created: 2026-05-27T12:41:58.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-05-27T13:21:31.000Z (about 1 month ago)
- Last Synced: 2026-05-27T15:12:43.618Z (about 1 month ago)
- Topics: cache, ddev, ddev-get, dragonfly, dragonflydb, redis
- Language: Shell
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ddev-dragonfly
A DDEV add-on that provides [DragonflyDB](https://www.dragonflydb.io/) 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.
## Installation
```bash
ddev add-on get ddev-dragonfly
ddev restart
```
After installation, the DragonflyDB service is available at `dragonfly:6379` from within the DDEV network.
## Commands
| Command | Description |
|---------|-------------|
| `ddev redis-cli` | Run redis-cli commands against DragonflyDB |
| `ddev dragonfly-flush` | Flush all keys (FLUSHALL ASYNC) |
### Examples
```bash
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 keys
```
## Configuration
Override defaults by setting environment variables in `.ddev/config.yaml`:
```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 |
### Default flags
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:
```yaml
services:
dragonfly:
command: dragonfly --port=6379 --maxmemory=1gb --cache_mode=true --proactor_threads=4
```
## Drupal integration
For Drupal 9+ projects, the add-on automatically:
1. Copies `settings.ddev.dragonfly.php` to `sites/default/`
2. 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](https://www.drupal.org/project/redis) installed and the PhpRedis PHP extension enabled (included in DDEV by default).
## Comparison with ddev-redis
| 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.
## Removal
```bash
ddev add-on remove dragonfly
ddev restart
```
This removes the DragonflyDB container and cleans up `settings.ddev.dragonfly.php` from your Drupal site if it contains the `#ddev-generated` marker.