Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

refactor(backend:cache): remove inherited lifecycle interfaces from Redis and MySQL adapters

johavenbefbdbb47ec6
diff --git a/backend/src/infrastructure/cache/adapters/mysql-cache.adapter.ts b/backend/src/infrastructure/cache/adapters/mysql-cache.adapter.ts
index e3a3ffb6..dc1e5adc 100644
--- a/backend/src/infrastructure/cache/adapters/mysql-cache.adapter.ts
+++ b/backend/src/infrastructure/cache/adapters/mysql-cache.adapter.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Inject, Injectable, Logger, OnModuleDestroy, OnModuleInit } from '@nestjs/common'
+import { Inject, Injectable, Logger } from '@nestjs/common'
import { SchedulerRegistry } from '@nestjs/schedule'
import { CronJob } from 'cron'
import { and, between, eq, exists, inArray, like, notBetween, SQL } from 'drizzle-orm'
@@ -20,7 +20,7 @@ import { cache } from '../schemas/mysql-cache.schema'
import { Cache } from '../services/cache.service'
@Injectable()
-export class MysqlCacheAdapter implements Cache, OnModuleInit, OnModuleDestroy {
+export class MysqlCacheAdapter implements Cache {
/* Useful SQL commands to stats the scheduler
SHOW VARIABLES LIKE 'event_scheduler';
SHOW EVENTS;
diff --git a/backend/src/infrastructure/cache/adapters/redis-cache.adapter.ts b/backend/src/infrastructure/cache/adapters/redis-cache.adapter.ts
index 8f92aa6e..8c71d43b 100644
--- a/backend/src/infrastructure/cache/adapters/redis-cache.adapter.ts
+++ b/backend/src/infrastructure/cache/adapters/redis-cache.adapter.ts
@@ -4,7 +4,7 @@
* See the LICENSE file for licensing details
*/
-import { Injectable, Logger, OnModuleInit } from '@nestjs/common'
+import { Injectable, Logger } from '@nestjs/common'
import { RedisClientOptions } from '@redis/client'
import { createClient, RedisClientType } from 'redis'
import { createSlug } from '../../../common/shared'
@@ -12,7 +12,7 @@ import { configuration } from '../../../configuration/config.environment'
import { Cache } from '../services/cache.service'
@Injectable()
-export class RedisCacheAdapter implements Cache, OnModuleInit {
+export class RedisCacheAdapter implements Cache {
defaultTTL: number = configuration.cache.ttl
infiniteExpiration = -1
private readonly logger = new Logger(Cache.name.toUpperCase())