MCPcopy Create free account
hub / github.com/ding113/claude-code-hub / getCacheStats

Function getCacheStats

src/actions/error-rules.ts:615–631  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

613 * 避免在新的 worker 进程中返回空统计信息
614 */
615export async function getCacheStats() {
616 try {
617 const session = await getSession();
618 if (!session || session.user.role !== "admin") {
619 return null;
620 }
621
622 // 确保缓存已初始化(懒加载)
623 // 解决重启后新 worker 进程中缓存为空的问题
624 await errorRuleDetector.ensureInitialized();
625
626 return errorRuleDetector.getStats();
627 } catch (error) {
628 logger.error("[ErrorRulesAction] Failed to get cache stats:", error);
629 return null;
630 }
631}

Callers 2

ErrorRulesRefreshActionFunction · 0.90

Calls 3

getSessionFunction · 0.90
ensureInitializedMethod · 0.45
getStatsMethod · 0.45

Tested by

no test coverage detected