@@ -526,3 +526,30 @@ export type ProgressResponse = {
526526 stage : string ;
527527 timeElapsed : number ;
528528} ;
529+
530+ // NOTE: This type must be kept in sync with CacheMode in @cubejs -backend/shared (packages/cubejs-backend-shared/src/shared-types.ts)
531+ // This duplication is intentional as @cubejs -client/core does not depend on @cubejs-backend/shared
532+ /**
533+ * Cache mode options for query execution.
534+ *
535+ * - **stale-if-slow** (default): Equivalent to previously used `renewQuery: false`.
536+ * If refresh keys are up-to-date, returns the value from cache.
537+ * If refresh keys are expired, tries to return the value from the database.
538+ * Returns fresh value from the database if the query executed until the first "Continue wait" interval is reached.
539+ * Returns stale value from cache otherwise.
540+ *
541+ * - **stale-while-revalidate**: AKA "backgroundRefresh".
542+ * If refresh keys are up-to-date, returns the value from cache.
543+ * If refresh keys are expired, returns stale data from cache.
544+ * Updates the cache in background.
545+ *
546+ * - **must-revalidate**: Equivalent to previously used `renewQuery: true`.
547+ * If refresh keys are up-to-date, returns the value from cache.
548+ * If refresh keys are expired, tries to return the value from the database.
549+ * Returns fresh value from the database even if it takes minutes and many "Continue wait" intervals.
550+ *
551+ * - **no-cache**: AKA "forceRefresh".
552+ * Skips refresh key checks.
553+ * Returns fresh data from the database, even if it takes minutes and many "Continue wait" intervals.
554+ */
555+ export type CacheMode = 'stale-if-slow' | 'stale-while-revalidate' | 'must-revalidate' | 'no-cache' ;
0 commit comments