parent
037837b551
commit
0e4a111f81
1714 changed files with 20803 additions and 11751 deletions
19
packages/backend/src/db/redis.ts
Normal file
19
packages/backend/src/db/redis.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import * as redis from 'redis';
|
||||
import config from '@/config/index';
|
||||
|
||||
export function createConnection() {
|
||||
return redis.createClient(
|
||||
config.redis.port,
|
||||
config.redis.host,
|
||||
{
|
||||
password: config.redis.pass,
|
||||
prefix: config.redis.prefix,
|
||||
db: config.redis.db || 0
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export const subsdcriber = createConnection();
|
||||
subsdcriber.subscribe(config.host);
|
||||
|
||||
export const redisClient = createConnection();
|
||||
Loading…
Add table
Add a link
Reference in a new issue