UNPKG

@kimsungwhee/apple-docs-mcp

Version:

MCP server for Apple Developer Documentation - Search iOS/macOS/SwiftUI/UIKit docs, WWDC videos, Swift/Objective-C APIs & code examples in Claude, Cursor & AI assistants

88 lines 2.74 kB
/** * Simple in-memory cache with TTL (Time To Live) support */ export declare class MemoryCache { private cache; private maxSize; private defaultTTL; private hits; private misses; constructor(maxSize?: number, defaultTTL?: number); /** * Get the current size of the cache */ size(): number; /** * Get all entries as array of [key, value] pairs */ entries(): [string, unknown][]; /** * Get value from cache */ get<T>(key: string): T | undefined; /** * Set value in cache */ set<T>(key: string, value: T, ttl?: number): void; /** * Check if key exists and is not expired */ has(key: string): boolean; /** * Delete entry from cache */ delete(key: string): boolean; /** * Clear all cache entries */ clear(): void; /** * Clean up expired entries */ private cleanup; /** * Get cache statistics */ getStats(): { size: number; maxSize: number; hitRate: string; hits: number; misses: number; }; /** * Get or set with async function */ getOrSet<T>(key: string, fetchFn: () => Promise<T>, ttl?: number): Promise<T>; } export declare const apiCache: MemoryCache; export declare const searchCache: MemoryCache; export declare const indexCache: MemoryCache; export declare const technologiesCache: MemoryCache; export declare const updatesCache: MemoryCache; export declare const sampleCodeCache: MemoryCache; export declare const technologyOverviewsCache: MemoryCache; export declare const wwdcDataCache: MemoryCache; /** * Generate cache key for URL-based requests */ export declare function generateUrlCacheKey(url: string, params?: Record<string, unknown>): string; /** * Generate cache key for enhanced analysis */ export declare function generateEnhancedCacheKey(url: string, options: { includeRelatedApis?: boolean; includeReferences?: boolean; includeSimilarApis?: boolean; includePlatformAnalysis?: boolean; }): string; /** * Cache decorator for async functions */ export declare function cached<T>(cache: MemoryCache, keyGenerator: (...args: unknown[]) => string, ttl?: number): (_target: unknown, _propertyName: string, descriptor: PropertyDescriptor) => void; /** * Cache decorator (alias for compatibility) */ export declare function withCache<T = any>(cache: MemoryCache, keyGenerator?: (...args: any[]) => string, ttl?: number): (_target: any, _propertyName: string, descriptor?: PropertyDescriptor) => PropertyDescriptor; export declare function getCacheInstance(name: string, maxSize?: number, defaultTTL?: number): MemoryCache; //# sourceMappingURL=cache.d.ts.map