cache-stats
Monitor and retrieve cache statistics for cryptocurrency exchange data, enabling efficient tracking and analysis of cache performance in the CCXT integration environment.
Instructions
Get CCXT cache statistics
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- src/index.ts:152-159 (handler)Inline handler function for the 'cache-stats' tool. It calls getCacheStats() and returns the statistics as formatted JSON text in the MCP response format.server.tool("cache-stats", "Get CCXT cache statistics", {}, async () => { return { content: [{ type: "text", text: JSON.stringify(getCacheStats(), null, 2) }] }; });
- src/utils/cache.ts:142-153 (helper)Core implementation of cache statistics retrieval. Returns detailed metrics including hit/miss counts and ratio, current cache size, maximum size, and last clear timestamp.export function getCacheStats() { return { hits: cacheStats.hits, misses: cacheStats.misses, hitRatio: cacheStats.hits + cacheStats.misses > 0 ? (cacheStats.hits / (cacheStats.hits + cacheStats.misses)).toFixed(2) : '0.00', size: dataCache.size, maxSize: dataCache.max, lastCleared: cacheStats.lastCleared }; }