/** * Cached WordPress API Client * Extends the base WordPress client with intelligent caching capabilities and performance monitoring */ import { WordPressClient } from "./api.js"; import { CacheManager, type CacheStats } from "../cache/CacheManager.js"; import type { WordPressClientConfig, HTTPMethod, RequestOptions } from "../types/client.js"; import type { WordPressPost, WordPressUser, WordPressCategory, WordPressTag, WordPressSiteSettings, PostQueryParams, CreatePostRequest, UpdatePostRequest } from "../types/wordpress.js"; /** * WordPress client with intelligent caching */ export declare class CachedWordPressClient extends WordPressClient { private cacheManager; private httpCache; private cacheInvalidation; private siteId; constructor(config: WordPressClientConfig, siteId?: string); /** * Override request method to add caching */ request(method: HTTPMethod, endpoint: string, data?: unknown, options?: RequestOptions): Promise; /** * Enhanced methods with caching optimization */ /** * Get posts with intelligent caching */ getPosts(params?: PostQueryParams): Promise; /** * Get single post with caching */ getPost(id: number, context?: "view" | "embed" | "edit"): Promise; /** * Create post with cache invalidation */ createPost(data: CreatePostRequest): Promise; /** * Update post with cache invalidation */ updatePost(data: UpdatePostRequest): Promise; /** * Delete post with cache invalidation */ deletePost(id: number, force?: boolean): Promise<{ deleted: boolean; previous?: WordPressPost; }>; /** * Get current user with session caching * Uses context=edit to ensure roles and capabilities are included */ getCurrentUser(): Promise; /** * Get categories with semi-static caching */ getCategories(params?: Record): Promise; /** * Get tags with semi-static caching */ getTags(params?: Record): Promise; /** * Get site settings with static caching */ getSiteSettings(): Promise; /** * Cache management methods */ /** * Private helper methods */ private extractEndpoint; /** * Get cache options based on endpoint */ private getCacheOptions; private normalizeEndpoint; private buildRequestUrl; /** * Handle cache invalidation for write operations */ private handleCacheInvalidation; /** * Extract resource type from endpoint */ private extractResourceFromEndpoint; /** * Extract ID from endpoint */ private extractIdFromEndpoint; /** * Check if endpoint contains static data */ private isStaticEndpoint; /** * Check if endpoint contains semi-static data */ private isSemiStaticEndpoint; /** * Check if endpoint is session-related */ private isSessionEndpoint; /** * Performance monitoring and cache management methods */ /** * Get cache statistics for performance monitoring */ getCacheStats(): { cache: CacheStats; invalidation: { queueSize: number; rulesCount: number; processing: boolean; }; }; /** * Get cache manager instance (for performance monitoring integration) */ getCacheManager(): CacheManager; /** * Clear cache entries (for cache management tools) */ clearCache(): number; /** * Clear cache entries matching pattern */ clearCachePattern(pattern: string): number; /** * Warm cache with essential data. * Each individual operation is capped at 10 s; the whole warm is capped at 25 s * so a single unresponsive WordPress endpoint can never hang the MCP request. */ warmCache(): Promise; /** * Get cache efficiency metrics */ getCacheEfficiency(): { hitRate: number; missRate: number; efficiency: string; memoryUsage: number; totalEntries: number; }; /** * Get cache configuration info */ getCacheInfo(): { enabled: boolean; siteId: string; maxSize: number; defaultTTL: number; currentSize: number; ttlPresets: Record; }; /** * Estimate memory usage of cache (in MB) */ private estimateMemoryUsage; /** * Get detailed cache performance metrics */ getDetailedCacheMetrics(): { statistics: { cache: CacheStats; invalidation: { queueSize: number; rulesCount: number; processing: boolean; }; }; efficiency: Record; configuration: Record; siteInfo: { siteId: string; baseUrl: string; }; }; } //# sourceMappingURL=CachedWordPressClient.d.ts.map