MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / appendToCache

Function appendToCache

console/src/platform/shell/commandCache.ts:49–69  ·  view source on GitHub ↗
({
  organizationId,
  regionId,
  command,
}: {
  organizationId?: string;
  regionId: string;
  command: string;
})

Source from the content-addressed store, hash-verified

47}
48
49export function appendToCache({
50 organizationId,
51 regionId,
52 command,
53}: {
54 organizationId?: string;
55 regionId: string;
56 command: string;
57}) {
58 if (storageAvailable("localStorage")) {
59 const cache = getCache({ organizationId, regionId });
60 cache.commands.push(command);
61 if (cache.commands.length > MAX_CACHED_COMMANDS) {
62 cache.commands.splice(0, cache.commands.length - MAX_CACHED_COMMANDS);
63 }
64 window.localStorage.setItem(
65 buildCacheKey({ organizationId, regionId }),
66 JSON.stringify(cache),
67 );
68 }
69}

Callers 2

ShellWebsocketProviderFunction · 0.90

Calls 4

storageAvailableFunction · 0.85
getCacheFunction · 0.85
buildCacheKeyFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected