@@ -13,7 +13,7 @@ type CacheStats = {
1313@Injectable ( )
1414export class CacheService implements OnModuleInit , OnModuleDestroy {
1515 private readonly logger = new Logger ( CacheService . name ) ;
16- private redis : Redis . Redis ;
16+ private redis : any ;
1717
1818 private readonly MEM_WARN_THRESHOLD = 80 ;
1919 private readonly MEM_CRIT_THRESHOLD = 90 ;
@@ -185,11 +185,11 @@ export class CacheService implements OnModuleInit, OnModuleDestroy {
185185
186186 async getMemoryUsage ( ) : Promise < { usedMemory : number ; maxMemory : number ; usagePercent : number } > {
187187 const info = await this . redis . info ( 'memory' ) ;
188- const parsed = info
188+ const parsed : Record < string , string > = info
189189 . split ( '\n' )
190- . map ( ( line ) => line . trim ( ) )
191- . filter ( ( line ) => line && ! line . startsWith ( '#' ) )
192- . reduce < Record < string , string > > ( ( acc , line ) => {
190+ . map ( ( line : string ) => line . trim ( ) )
191+ . filter ( ( line : string ) => line && ! line . startsWith ( '#' ) )
192+ . reduce ( ( acc : Record < string , string > , line : string ) => {
193193 const [ k , v ] = line . split ( ':' ) ;
194194 if ( k && v ) acc [ k ] = v ;
195195 return acc ;
@@ -243,66 +243,3 @@ export class CacheService implements OnModuleInit, OnModuleDestroy {
243243 } ;
244244 }
245245}
246-
247-
248- async getActiveRaffles ( ) : Promise < any | null > {
249- return this . get ( 'raffle:active' ) ;
250- }
251-
252- async setActiveRaffles ( raffles : any ) : Promise < void > {
253- await this . set ( 'raffle:active' , raffles , this . TTLS . ACTIVE_RAFFLES ) ;
254- }
255-
256- async invalidateActiveRaffles ( ) : Promise < void > {
257- await this . del ( 'raffle:active' ) ;
258- }
259-
260-
261- async getRaffleDetail ( id : string ) : Promise < any | null > {
262- return this . get ( `raffle:${ id } ` ) ;
263- }
264-
265- async setRaffleDetail ( id : string , detail : any ) : Promise < void > {
266- await this . set ( `raffle:${ id } ` , detail , this . TTLS . RAFFLE_DETAIL ) ;
267- }
268-
269- async invalidateRaffleDetail ( id : string ) : Promise < void > {
270- await this . del ( `raffle:${ id } ` ) ;
271- }
272-
273- async getLeaderboard ( ) : Promise < any | null > {
274- return this . get ( 'leaderboard' ) ;
275- }
276-
277- async setLeaderboard ( leaderboard : any ) : Promise < void > {
278- await this . set ( 'leaderboard' , leaderboard , this . TTLS . LEADERBOARD ) ;
279- }
280-
281- async invalidateLeaderboard ( ) : Promise < void > {
282- await this . del ( 'leaderboard' ) ;
283- }
284-
285- async getUserProfile ( address : string ) : Promise < any | null > {
286- return this . get ( `user:${ address } ` ) ;
287- }
288-
289- async setUserProfile ( address : string , profile : any ) : Promise < void > {
290- await this . set ( `user:${ address } ` , profile , this . TTLS . USER_PROFILE ) ;
291- }
292-
293- async invalidateUserProfile ( address : string ) : Promise < void > {
294- await this . del ( `user:${ address } ` ) ;
295- }
296-
297- async getPlatformStats ( ) : Promise < any | null > {
298- return this . get ( 'stats:platform' ) ;
299- }
300-
301- async setPlatformStats ( stats : any ) : Promise < void > {
302- await this . set ( 'stats:platform' , stats , this . TTLS . PLATFORM_STATS ) ;
303- }
304-
305- async invalidatePlatformStats ( ) : Promise < void > {
306- await this . del ( 'stats:platform' ) ;
307- }
308- }
0 commit comments