UNPKG

1.4 kBTypeScriptView Raw
1import { QueryResultCacheOptions } from "./QueryResultCacheOptions";
2import { QueryRunner } from "../query-runner/QueryRunner";
3/**
4 * Implementations of this interface provide different strategies to cache query builder results.
5 */
6export interface QueryResultCache {
7 /**
8 * Creates a connection with given cache provider.
9 */
10 connect(): Promise<void>;
11 /**
12 * Closes a connection with given cache provider.
13 */
14 disconnect(): Promise<void>;
15 /**
16 * Performs operations needs to be created during schema synchronization.
17 */
18 synchronize(queryRunner?: QueryRunner): Promise<void>;
19 /**
20 * Caches given query result.
21 */
22 getFromCache(options: QueryResultCacheOptions, queryRunner?: QueryRunner): Promise<QueryResultCacheOptions | undefined>;
23 /**
24 * Stores given query result in the cache.
25 */
26 storeInCache(options: QueryResultCacheOptions, savedCache: QueryResultCacheOptions | undefined, queryRunner?: QueryRunner): Promise<void>;
27 /**
28 * Checks if cache is expired or not.
29 */
30 isExpired(savedCache: QueryResultCacheOptions): boolean;
31 /**
32 * Clears everything stored in the cache.
33 */
34 clear(queryRunner?: QueryRunner): Promise<void>;
35 /**
36 * Removes all cached results by given identifiers from cache.
37 */
38 remove(identifiers: string[], queryRunner?: QueryRunner): Promise<void>;
39}