Skip to content

Commit 64b6831

Browse files
committed
code polish
1 parent 17b1221 commit 64b6831

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

packages/cubejs-query-orchestrator/src/orchestrator/QueryCache.ts

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import crypto from 'crypto';
22
import csvWriter from 'csv-write-stream';
33
import { LRUCache } from 'lru-cache';
44
import { pipeline } from 'stream';
5-
import { AsyncDebounce, getEnv, MaybeCancelablePromise, streamToArray } from '@cubejs-backend/shared';
5+
import {
6+
AsyncDebounce,
7+
getEnv,
8+
MaybeCancelablePromise,
9+
streamToArray,
10+
CacheMode,
11+
} from '@cubejs-backend/shared';
612
import { CubeStoreCacheDriver, CubeStoreDriver } from '@cubejs-backend/cubestore-driver';
713
import {
814
BaseDriver,
@@ -19,7 +25,23 @@ import { DriverFactory, DriverFactoryByDataSource } from './DriverFactory';
1925
import { LoadPreAggregationResult, PreAggregationDescription } from './PreAggregations';
2026
import { getCacheHash } from './utils';
2127
import { CacheAndQueryDriverType, MetadataOperationType } from './QueryOrchestrator';
22-
import { CacheMode } from '@cubejs-backend/shared';
28+
29+
export type CacheQueryResultOptions = {
30+
renewalThreshold?: number,
31+
renewalKey?: any,
32+
priority?: number,
33+
external?: boolean,
34+
requestId?: string,
35+
dataSource: string,
36+
waitForRenew?: boolean,
37+
forceNoCache?: boolean,
38+
useInMemory?: boolean,
39+
useCsvQuery?: boolean,
40+
lambdaTypes?: TableStructure,
41+
persistent?: boolean,
42+
primaryQuery?: boolean,
43+
renewCycle?: boolean,
44+
};
2345

2446
type QueryOptions = {
2547
external?: boolean;
@@ -848,22 +870,7 @@ export class QueryCache {
848870
values: string[],
849871
cacheKey: CacheKey,
850872
expiration: number,
851-
options: {
852-
renewalThreshold?: number,
853-
renewalKey?: any,
854-
priority?: number,
855-
external?: boolean,
856-
requestId?: string,
857-
dataSource: string,
858-
waitForRenew?: boolean,
859-
forceNoCache?: boolean,
860-
useInMemory?: boolean,
861-
useCsvQuery?: boolean,
862-
lambdaTypes?: TableStructure,
863-
persistent?: boolean,
864-
primaryQuery?: boolean,
865-
renewCycle?: boolean,
866-
}
873+
options: CacheQueryResultOptions,
867874
) {
868875
const spanId = crypto.randomBytes(16).toString('hex');
869876
options = options || { dataSource: 'default' };

0 commit comments

Comments
 (0)