wp_cache_info
Retrieve WordPress cache configuration and status details to monitor performance and optimize site speed.
Instructions
Get detailed cache configuration and status information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site | No | Site ID to get cache info for. |
Implementation Reference
- src/tools/cache.ts:63-74 (registration)Registration of the 'wp_cache_info' tool in CacheTools.getTools(), including name, description, input schema (parameters), and handler binding.{ name: "wp_cache_info", description: "Get detailed cache configuration and status information.", parameters: [ { name: "site", type: "string", description: "Site ID to get cache info for.", }, ], handler: this.handleGetCacheInfo.bind(this), },
- src/tools/cache.ts:177-226 (handler)The main handler function for 'wp_cache_info' tool. Resolves the WordPress client, checks if caching is enabled, fetches cache stats, and returns detailed configuration, TTL presets, current stats, invalidation info, and performance benefits.async handleGetCacheInfo(params: { site?: string }) { return toolWrapper(async () => { const client = this.resolveClient(params.site); if (!(client instanceof CachedWordPressClient)) { return { caching_enabled: false, message: "Caching is disabled for this site.", how_to_enable: "Remove DISABLE_CACHE=true from environment variables or set it to false.", }; } const stats = client.getCacheStats(); return { caching_enabled: true, cache_configuration: { max_size: "Configured in SecurityConfig.cache.maxSize", default_ttl: "Configured in SecurityConfig.cache.defaultTTL", lru_enabled: "Configured in SecurityConfig.cache.enableLRU", stats_enabled: "Configured in SecurityConfig.cache.enableStats", }, ttl_presets: { static_data: "4 hours (site settings, user roles)", semi_static_data: "2 hours (categories, tags, user profiles)", dynamic_data: "15 minutes (posts, pages, comments)", session_data: "30 minutes (authentication, current user)", realtime_data: "1 minute (real-time data)", }, current_stats: { total_entries: stats.cache.totalSize, hit_rate: Math.round(stats.cache.hitRate * 100) + "%", hits: stats.cache.hits, misses: stats.cache.misses, evictions: stats.cache.evictions, }, invalidation_info: { queue_size: stats.invalidation.queueSize, rules_registered: stats.invalidation.rulesCount, currently_processing: stats.invalidation.processing, }, performance_benefits: [ "Reduced API calls to WordPress", "Faster response times for repeated requests", "Better rate limit utilization", "Improved user experience", ], }; }); }
- src/tools/cache.ts:67-71 (schema)Input schema definition for the tool: optional 'site' parameter of type string.{ name: "site", type: "string", description: "Site ID to get cache info for.", },