forked from typeorm/typeorm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueryResultCache.ts
More file actions
49 lines (39 loc) · 1.37 KB
/
QueryResultCache.ts
File metadata and controls
49 lines (39 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import {QueryResultCacheOptions} from "./QueryResultCacheOptions";
import {QueryRunner} from "../query-runner/QueryRunner";
/**
* Implementations of this interface provide different strategies to cache query builder results.
*/
export interface QueryResultCache {
/**
* Creates a connection with given cache provider.
*/
connect(): Promise<void>;
/**
* Closes a connection with given cache provider.
*/
disconnect(): Promise<void>;
/**
* Performs operations needs to be created during schema synchronization.
*/
synchronize(queryRunner?: QueryRunner): Promise<void>;
/**
* Caches given query result.
*/
getFromCache(options: QueryResultCacheOptions, queryRunner?: QueryRunner): Promise<QueryResultCacheOptions|undefined>;
/**
* Stores given query result in the cache.
*/
storeInCache(options: QueryResultCacheOptions, savedCache: QueryResultCacheOptions|undefined, queryRunner?: QueryRunner): Promise<void>;
/**
* Checks if cache is expired or not.
*/
isExpired(savedCache: QueryResultCacheOptions): boolean;
/**
* Clears everything stored in the cache.
*/
clear(queryRunner?: QueryRunner): Promise<void>;
/**
* Removes all cached results by given identifiers from cache.
*/
remove(identifiers: string[], queryRunner?: QueryRunner): Promise<void>;
}