MCPcopy Create free account
hub / github.com/msgbyte/tianji / getServerMapFromCache

Function getServerMapFromCache

src/server/model/serverStatus.ts:17–34  ·  view source on GitHub ↗
(
  workspaceId: string
)

Source from the content-addressed store, hash-verified

15
16// Helper function to get server map from cache
17export async function getServerMapFromCache(
18 workspaceId: string
19): Promise<Record<string, ServerStatusInfo>> {
20 const cacheManager = await getCacheManager();
21 const key = getServerMapCacheKey(workspaceId);
22
23 const cachedValue = await cacheManager.get(key);
24 if (cachedValue) {
25 try {
26 return JSON.parse(String(cachedValue));
27 } catch (err) {
28 logger.error('[ServerStatus] Error parsing cached server map:', err);
29 return {};
30 }
31 }
32
33 return {};
34}
35
36// Helper function to save server map to cache
37async function saveServerMapToCache(

Callers 5

serverStatus.tsFile · 0.85
recordServerStatusFunction · 0.85
clearOfflineServerStatusFunction · 0.85
getServerCountFunction · 0.85
serverStatus.tsFile · 0.85

Calls 5

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

Tested by

no test coverage detected