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

Function getCache

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

Source from the content-addressed store, hash-verified

27}
28
29export function getCache({
30 organizationId,
31 regionId,
32}: {
33 organizationId?: string;
34 regionId: string;
35}): CommandCache {
36 const cacheString = storageAvailable("localStorage")
37 ? window.localStorage.getItem(buildCacheKey({ organizationId, regionId }))
38 : null;
39 if (cacheString === null) {
40 // The version number may only be incremented if a migration exists.
41 return { version: 1, commands: [] };
42 }
43 const cache: CommandCache = JSON.parse(cacheString);
44 // TODO: when we have a version that is not v1, migrations should be
45 // performed here.
46 return cache;
47}
48
49export function appendToCache({
50 organizationId,

Callers 3

useResetPromptCacheFunction · 0.90
appendToCacheFunction · 0.85

Calls 3

storageAvailableFunction · 0.85
buildCacheKeyFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected