mirror of
https://github.com/tornadocash/tornado-relayer.git
synced 2024-10-01 08:25:37 -04:00
20 lines
435 B
JavaScript
20 lines
435 B
JavaScript
const { redisUrl } = require('../config')
|
|
const Redis = require('ioredis')
|
|
const redisClient = new Redis(redisUrl)
|
|
const subscriber = new Redis(redisUrl)
|
|
|
|
const redisOpts = {
|
|
createClient: function (type) {
|
|
switch (type) {
|
|
case 'client':
|
|
return redisClient
|
|
case 'subscriber':
|
|
return subscriber
|
|
default:
|
|
return new Redis(redisUrl)
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = { redisOpts, redisClient }
|