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

Function saveServerHistoryToCache

src/server/model/serverStatus.ts:78–91  ·  view source on GitHub ↗
(
  workspaceId: string,
  name: string,
  history: ServerStatusInfo[]
)

Source from the content-addressed store, hash-verified

76
77// Helper function to save server history to cache
78async function saveServerHistoryToCache(
79 workspaceId: string,
80 name: string,
81 history: ServerStatusInfo[]
82): Promise<void> {
83 const cacheManager = await getCacheManager();
84 const key = getServerHistoryCacheKey(workspaceId, name);
85
86 try {
87 await cacheManager.set(key, JSON.stringify(history));
88 } catch (err) {
89 logger.error('[ServerStatus] Error saving history to cache:', err);
90 }
91}
92
93createSubscribeInitializer('onServerStatusUpdate', async (workspaceId) => {
94 return await getServerMapFromCache(workspaceId);

Callers 1

recordServerStatusFunction · 0.85

Calls 3

getCacheManagerFunction · 0.85
getServerHistoryCacheKeyFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected