Closed ilteoood closed 1 year ago
Dragonfly aims to be 100% Redis compatible.
It would be great to support it in this plugin.
Dragonfly doesn't provide any additional tool, they suggest to use what the Redis community provides because their APIs aims to be 100% compatible with it.
'use strict' const Fastify = require('fastify') const fastifyRedis = require('@fastify/redis') const fastify = Fastify({ logger: true }) fastify.register(fastifyRedis, { host: '127.0.0.1', password: 'your strong password here', port: 6379, // Dragonfly port family: 4 // 4 (IPv4) or 6 (IPv6), isDragonfly: true }) fastify.get('/foo', (req, reply) => { const { dragonfly } = fastify dragonfly.get(req.query.key, (err, val) => { reply.send(err || val) }) }) fastify.post('/foo', (req, reply) => { const { dragonfly } = fastify dragonfly.set(req.body.key, req.body.value, (err) => { reply.send(err || { status: 'ok' }) }) }) fastify.listen({ port: 3000 }, err => { if (err) throw err console.log(`server listening on ${fastify.server.address().port}`) })
Prerequisites
🚀 Feature Proposal
Dragonfly aims to be 100% Redis compatible.
It would be great to support it in this plugin.
Motivation
Dragonfly doesn't provide any additional tool, they suggest to use what the Redis community provides because their APIs aims to be 100% compatible with it.
Example