MCPcopy Create free account
hub / github.com/microsoft/data-formulator / computeCacheKey

Function computeCacheKey

src/app/chartCache.ts:104–127  ·  view source on GitHub ↗
(
    chartType: string,
    encodingMap: any,
    config: any,
    tableRowCount: number,
    tableContentHash: string | undefined,
    tableId: string,
    tableMetadata?: any,
    activeVariantId?: string,
    activeVariantSpec?: any,
)

Source from the content-addressed store, hash-verified

102 * for the data sizes involved (~KB range).
103 */
104export function computeCacheKey(
105 chartType: string,
106 encodingMap: any,
107 config: any,
108 tableRowCount: number,
109 tableContentHash: string | undefined,
110 tableId: string,
111 tableMetadata?: any,
112 activeVariantId?: string,
113 activeVariantSpec?: any,
114): string {
115 return JSON.stringify({
116 chartType,
117 encodingMap,
118 config: config || {},
119 tableRowCount,
120 tableContentHash: tableContentHash || tableId,
121 tableMetadata: tableMetadata || {},
122 // Variant fields are intentionally last so default-chart cache keys
123 // are stable across versions that didn't track variants.
124 activeVariantId: activeVariantId || null,
125 activeVariantSpec: activeVariantSpec || null,
126 });
127}

Callers 1

ChartRenderServiceFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected