Closed rhighs closed 1 year ago
Why can't you create yourself?
const ioredis = require('ioredis')
const nodeRedisConfig = {
socket: {
host: '127.0.0.1',
port: 6379, // Redis port
family: 4 // 4 (IPv4) or 6 (IPv6)
},
password: '***'
}
fastify.register(require('@fastify/redis'), {
client: ioredis.createClient({
...nodeRedisConfig,
creationMethod: 'node-redis'
})
})
https://github.com/luin/ioredis/blob/92aefaac13f42ad14986fde47c640ff8edc415ef/lib/Redis.ts#L76-L78
Given ioredis.createClient
is a wrapper of new Redis
.
I didn't see any special we need to done.
Yep, silly me it's way better like this, closing... Thank you! @climba03003
Prerequisites
π Feature Proposal
Since ioredis supports node-redis configuration objects it would be nice to include a plugin option that enables developers to create a client via ioredis createClient(...) rather than
new Redis()
Motivation
Compatibility with node-redis config objects, although for the sake of clarity it might just be fine to pass a ready made ioredis client to fastify-redis at init time.
Example