Files
lib/src/util/cache/Cache.ts
garrettmills 1d5056b753
All checks were successful
continuous-integration/drone/push Build is passing
Setup eslint and enforce rules
2021-06-02 22:36:25 -05:00

34 lines
845 B
TypeScript

import {Awaitable} from '../support/types'
/**
* Abstract interface class for a cached object.
*/
export abstract class Cache {
/**
* Fetch a value from the cache by its key.
* @param {string} key
* @return Promise<any|undefined>
*/
public abstract fetch(key: string): Awaitable<string|undefined>;
/**
* Store the given value in the cache by key.
* @param {string} key
* @param {string} value
*/
public abstract put(key: string, value: string): Awaitable<void>;
/**
* Check if the cache has the given key.
* @param {string} key
* @return Promise<boolean>
*/
public abstract has(key: string): Awaitable<boolean>;
/**
* Drop the given key from the cache.
* @param {string} key
*/
public abstract drop(key: string): Awaitable<void>;
}