bc-node-sdk
Version:
BetterCommerce's NodeJS SDK encapsulates the base framework for all the Next.js applications.
34 lines (33 loc) • 1.48 kB
TypeScript
/**
* Interface {@link ICacheManager} represents cache manager.
*/
export default interface ICacheManager {
/**
* Retrieves the value associated with the given key from the cache.
* If the `prefix` parameter is given, it will be prepended to the key.
* @param key The key to retrieve from the cache.
* @param prefix An optional prefix to prepend to the key.
* @returns The value associated with the given key or null if the key does not exist in the cache.
*/
get(key: string, prefix?: string): any;
/**
* Sets the value associated with the given key in the cache.
* If the `prefix` parameter is given, it will be prepended to the key.
* @param key The key to set in the cache.
* @param value The value to associate with the key.
* @param prefix An optional prefix to prepend to the key.
* @param expiresIn The time in seconds for which the key should be stored in the cache.
*/
set(key: string, value: any, prefix?: string, expiresIn?: number): void;
/**
* Deletes the value associated with the given key from the cache.
* If the `prefix` parameter is given, it will be prepended to the key.
* @param key The key to delete from the cache.
* @param prefix An optional prefix to prepend to the key.
*/
delete(key: string, prefix?: string): void;
/**
* Resets the cache by clearing all keys.
*/
reset(): void;
}