MCPcopy
hub / github.com/msgbyte/tianji / getServerHistoryFromCache

Function getServerHistoryFromCache

src/server/model/serverStatus.ts:57–75  ·  view source on GitHub ↗
(
  workspaceId: string,
  name: string
)

Source from the content-addressed store, hash-verified

55
56// Helper function to get server history from cache
57async function getServerHistoryFromCache(
58 workspaceId: string,
59 name: string
60): Promise<ServerStatusInfo[]> {
61 const cacheManager = await getCacheManager();
62 const key = getServerHistoryCacheKey(workspaceId, name);
63
64 const cachedValue = await cacheManager.get(key);
65 if (cachedValue) {
66 try {
67 return JSON.parse(String(cachedValue));
68 } catch (err) {
69 logger.error('[ServerStatus] Error parsing cached history:', err);
70 return [];
71 }
72 }
73
74 return [];
75}
76
77// Helper function to save server history to cache
78async function saveServerHistoryToCache(

Callers 2

recordServerStatusFunction · 0.85
getServerStatusHistoryFunction · 0.85

Calls 5

getCacheManagerFunction · 0.85
getServerHistoryCacheKeyFunction · 0.85
parseMethod · 0.80
errorMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected