import { Day } from "@shared/utils/time"; import type { CacheResult } from "../CacheHelper"; /** * A Mock Helper class for server-side cache management */ export class CacheHelper { // Default expiry time for cache data in seconds private static defaultDataExpiry = Day.seconds; /** * Mocked method that resolves with the callback result */ public static async getDataOrSet( key: string, callback: () => Promise | undefined>, _expiry: number, _lockTimeout?: number ): Promise { const result = await callback(); if (result && typeof result === "object" && "data" in result) { return (result as CacheResult).data; } return result as T | undefined; } /** * Mocked method that resolves with undefined */ public static async getData(_key: string): Promise { return undefined; } /** * Mocked method that resolves with void */ public static async setData(_key: string, _data: T, _expiry?: number) { return; } /** * Mocked method that resolves with void */ public static async clearData(_prefix: string) { return; } }