Skip to content

Commit

Permalink
feat: default redis ttl to 1 year
Browse files Browse the repository at this point in the history
  • Loading branch information
acaldas committed Jul 22, 2024
1 parent 5c9cb78 commit 781255f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/src/modules/document/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const loggerAdapter = new Proxy<ILogger>(documentDriveLogger as unknown as ILogg
setLogger(loggerAdapter);

const redisClient = process.env.REDIS_TLS_URL ? await initRedis() : undefined;
const redisTTL = process.env.REDIS_TTL ? parseInt(process.env.REDIS_TTL, 10) : 31556952; // defaults to 1 year

export function getDocumentDriveCRUD(prisma: Prisma.TransactionClient) {
const documentModels = [
Expand All @@ -59,7 +60,7 @@ export function getDocumentDriveCRUD(prisma: Prisma.TransactionClient) {
driveServer = new DocumentDriveServer(
documentModels,
new PrismaStorage(prisma as PrismaClient),
redisClient ? new RedisCache(redisClient) : new MemoryCache(),
redisClient ? new RedisCache(redisClient, redisTTL) : new MemoryCache(),
redisClient ? new RedisQueueManager(1, 10, redisClient) : new BaseQueueManager(3, 10),
);

Expand Down

0 comments on commit 781255f

Please sign in to comment.