-
Notifications
You must be signed in to change notification settings - Fork 135
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
feat: add dragonfly
driver
#353
Open
oritwoen
wants to merge
4
commits into
unjs:main
Choose a base branch
from
oritwoen:feat/dragonfly-export
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a170f67
feat(driver): add export and info about `dragonfly`
oritwoen 733c396
chore: apply automated lint fixes
autofix-ci[bot] 7031bad
Merge remote-tracking branch 'origin/main' into feat/dragonfly-export
oritwoen 177ecab
chore: apply automated lint fixes
autofix-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Dragonfly | ||
|
||
Store data in a [Dragonfly](https://www.dragonflydb.io/) storage using [ioredis](https://github.com/luin/ioredis). | ||
|
||
::alert{type="warning"} | ||
Currently, Dragonfly uses the same API and driver as [redis](/drivers/redis). | ||
:: | ||
|
||
```js | ||
import { createStorage } from "unstorage"; | ||
import dragonflyDriver from "unstorage/drivers/dragonfly"; | ||
|
||
const storage = createStorage({ | ||
driver: dragonflyDriver({ | ||
base: "unstorage", | ||
host: 'HOSTNAME', | ||
tls: true as any, | ||
port: 6380, | ||
password: 'DRAGONFLY_PASSWORD' | ||
}), | ||
}); | ||
``` | ||
|
||
::alert{type="info"} | ||
For more advanced configurations, follow the same steps as the documentation for the [redis](/drivers/redis) driver. | ||
:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need a entry file even if it is simple reexport
At least defaults such as
tls
andport
could be enabled by default also this way (haven't tried, if needed)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pi0 Your own export is a good idea.
However, in my opinion, first the Redis interface in the repository needs to be better organized. There are more and more libraries that have a virtually identical interface and unstorage will certainly support more of them in the future.
The difference between
Redis
,Dragonfly
,VercelKV
,Upstash
etc. is nominal and it is possible to create a universal interface for all drivers that use redis.With dragonfly
unstorage
would already have 3 drivers using redis, so it's high time to organize it better.I have an idea to create a separate PR in which the current drivers (Redis and VercelKV) would be separated into
utils
and thus, for each new driver that uses redis, it would be possible to import ready-made functions with their own configurations instead of constantly repeating the code.And then go back to this PR, do a separate export and use these utils. What do you think about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can extend from redis and refactor other drivers later if can save us maintenance time but give same possibilities why not π― (I prefer feat > refactor)
However keep in mind, while all these are redis-compatible drivers, some like vercel one, depends on specific SDK like
@vercel/kv
that essentially wraps with default environment variables. Yes, we can remove this layer but it requires us to keep in sync with what env variables vercel provides.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pi0 I currently don't have a good idea or time on how to deal with the topic mentioned in the comments above.
So I made a clone of the redis driver for dragonfly and corrected and updated the pull request.
Close or merge whatever you think is right. Due to these comments, if something comes to my mind, I will open a discussion or a new pull request.