get_cache_stats
Retrieve statistics about query cache performance and usage to monitor memory management effectiveness.
Instructions
獲取查詢緩存統計信息
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_cache_stats"
}
}Input 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 }; }