Added redis

This commit is contained in:
2024-02-13 23:11:34 +03:00
parent e003a87ba2
commit 52dceca24e
6 changed files with 231 additions and 78 deletions

View File

@@ -0,0 +1,19 @@
import { CacheModuleAsyncOptions } from '@nestjs/cache-manager';
import { redisStore } from 'cache-manager-redis-store';
import { config } from 'config';
export const RedisOptions: CacheModuleAsyncOptions = {
isGlobal: true,
useFactory: async () => {
const store = await redisStore({
socket: {
host: config.redis.redis_host,
port: config.redis.redis_port,
passphrase: config.redis.redis_password,
},
});
return {
store: () => store,
};
},
};