You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
825 B
33 lines
825 B
|
|
/**
|
|
* Abstract interface class for an application cache object.
|
|
*/
|
|
export default abstract class Cache {
|
|
/**
|
|
* Fetch a value from the cache by its key.
|
|
* @param {string} key
|
|
* @return Promise<any|undefined>
|
|
*/
|
|
public abstract async fetch(key: string): Promise<any>;
|
|
|
|
/**
|
|
* Store the given value in the cache by key.
|
|
* @param {string} key
|
|
* @param {string} value
|
|
*/
|
|
public abstract async put(key: string, value: string): Promise<void>;
|
|
|
|
/**
|
|
* Check if the cache has the given key.
|
|
* @param {string} key
|
|
* @return Promise<boolean>
|
|
*/
|
|
public abstract async has(key: string): Promise<boolean>;
|
|
|
|
/**
|
|
* Drop the given key from the cache.
|
|
* @param {string} key
|
|
*/
|
|
public abstract async drop(key: string): Promise<void>;
|
|
}
|