2020-12-03 03:19:39 +00:00
|
|
|
/**
|
|
|
|
* ICacheAdapter is the interface to be implemented by Cache Adapters for them to be usable with Harmony.
|
|
|
|
*
|
|
|
|
* Methods can return Promises too.
|
|
|
|
*/
|
2020-10-31 11:45:33 +00:00
|
|
|
export interface ICacheAdapter {
|
2020-12-05 02:24:08 +00:00
|
|
|
/** Gets a key from a Cache */
|
2020-11-01 11:22:09 +00:00
|
|
|
get: (cacheName: string, key: string) => Promise<any> | any
|
2020-12-05 02:24:08 +00:00
|
|
|
/** Sets a key to value in a Cache Name with optional expire value in MS */
|
2020-12-02 12:29:52 +00:00
|
|
|
set: (
|
|
|
|
cacheName: string,
|
|
|
|
key: string,
|
|
|
|
value: any,
|
|
|
|
expire?: number
|
|
|
|
) => Promise<any> | any
|
2020-12-05 02:24:08 +00:00
|
|
|
/** Deletes a key from a Cache */
|
2020-11-01 11:22:09 +00:00
|
|
|
delete: (cacheName: string, key: string) => Promise<boolean> | boolean
|
2020-12-05 02:24:08 +00:00
|
|
|
/** Gets array of all values in a Cache */
|
2020-11-02 16:31:10 +00:00
|
|
|
array: (cacheName: string) => undefined | any[] | Promise<any[] | undefined>
|
2020-12-05 02:24:08 +00:00
|
|
|
/** Entirely deletes a Cache */
|
2020-11-02 12:08:38 +00:00
|
|
|
deleteCache: (cacheName: string) => any
|
2020-10-31 11:45:33 +00:00
|
|
|
}
|