import { MoodleClient } from "../moodle/client.js"; /** * Shared cache for categories and courses. * * Both list-categories.ts and list-courses.ts import from here to avoid a * circular dependency. Caches are hydrated from memory first, then from a * server-side file cache, and finally from Moodle when no valid cache exists. */ export type Category = { id: number; name: string; description: string; parent: number; depth: number; path: string; }; export type Course = { id: number; fullname: string; shortname: string; categoryid?: number; visible: number; enablecompletion?: number; }; export type CacheTarget = "courses" | "categories"; export type CacheTargetOrAll = CacheTarget | "all"; type CacheSource = "memory" | "disk" | "moodle"; type DiskCacheStatus = "missing" | "fresh" | "stale" | "wrong_site" | "wrong_version" | "invalid" | "corrupt"; export type CacheRefreshResult = { target: CacheTarget; source: "moodle"; count: number; }; export type CacheClearResult = { target: CacheTarget; memoryCleared: boolean; persistentCleared: boolean; }; export type CacheStatus = { target: CacheTarget; memory: { loaded: boolean; count: number; }; disk: { exists: boolean; valid: boolean; status: DiskCacheStatus; path?: string; bytes: number | null; count: number | null; version: string | null; moodleUrl: string | null; moodleUrlMatches: boolean | null; createdAt: string | null; updatedAt: string | null; expiresAt: string | null; ageMinutes: number | null; ttlRemainingMinutes: number | null; error: string | null; }; }; export declare function getCategories(client: MoodleClient): Promise; export declare function getCourses(client: MoodleClient): Promise; export declare function clearCache(target?: CacheTargetOrAll): Promise; export declare function refreshCache(client: MoodleClient, target?: CacheTargetOrAll): Promise; export declare function warmupCaches(client: MoodleClient): Promise; export declare function getCacheState(): Array<{ target: CacheTarget; source: Exclude | "empty"; count: number; }>; export declare function getCacheStatus(client: MoodleClient, target?: CacheTargetOrAll): CacheStatus[]; export {}; //# sourceMappingURL=cache.d.ts.map