get_cache_stats
Retrieve statistics about query cache performance and usage to monitor memory management effectiveness.
Instructions
獲取查詢緩存統計信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.js:197-205 (registration)Registers the get_cache_stats tool with empty input schema, system scope, and a handler that delegates to queryCache.getStats() for retrieving query cache statistics.registerTool({ name: 'get_cache_stats', description: '獲取查詢緩存統計信息', inputSchema: z.object({}), scope: 'system', async handler() { return queryCache.getStats(); } }, 'system');
- src/utils/query-cache.js:97-109 (helper)The getStats() method of QueryCache class that returns detailed statistics including hits, misses, hit rate, current size, and maximum size.getStats() { const total = this.hits + this.misses; const hitRate = total > 0 ? (this.hits / total * 100).toFixed(2) : 0; return { hits: this.hits, misses: this.misses, total, hitRate: `${hitRate}%`, size: this.cache.size, maxSize: this.maxSize }; }