Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Document DragonflyDB support #1564

Merged
merged 5 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ func (s *Storage) Keys() ([][]byte, error)
```
### Installation
Redis is tested on the 2 last [Go versions](https://golang.org/dl/) with support for modules. So make sure to initialize one first if you didn't do that yet:

> **Note:** You can also use [DragonflyDB](https://dragonflydb.io/) as a Redis replacement.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing spaces.

> Since DragonflyDB is fully compatible with the Redis API, you can use it exactly like Redis **without any code changes**.
> [Example](#example-using-dragonflydb)


```bash
go mod init github.com/<user>/<repo>
```
Expand Down Expand Up @@ -194,3 +200,7 @@ var ConfigDefault = Config{
SentinelPassword: "",
}
```

### Example: Using DragonflyDB
> **Note:** You can use [DragonflyDB](https://dragonflydb.io/) in the same way as Redis.
> Simply start a DragonflyDB server and configure it just like Redis. Then, call `New()` and use it exactly as you would with Redis.
2 changes: 2 additions & 0 deletions redis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
)

// Config defines the config for storage.
//
// Dragonfly and Redis share the same config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need this new comments here. The ones in the README are enough.

type Config struct {
// Host name where the DB is hosted
//
Expand Down
6 changes: 5 additions & 1 deletion redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ type Storage struct {
db redis.UniversalClient
}

// New creates a new redis storage
// New creates a new Redis storage instance.
//
// DragonflyDB is fully compatible with the Redis API, meaning it can be used as a drop-in replacement for Redis.
//
// Because of this compatibility, DragonflyDB can also be initialized through this function.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need this new comments here. The ones in the README are enough.

func New(config ...Config) *Storage {
// Set default config
cfg := configDefault(config...)
Expand Down