import { ISpruceContext } from '../interfaces/ctx'; import SpruceSkillService from '../lib/SpruceSkillService'; export declare abstract class AbstractSpruceSkillCacheAdapter { abstract init(options: { url?: string; defaultTTL?: number; isDisabled?: boolean; keyPrefix?: string; }): void; abstract get(key: string): Promise | void>; abstract set(key: string, val: any, ttl?: number): Promise; abstract del(key: string): Promise; abstract delWildcard(key: string): Promise; abstract isConnected(): boolean; } interface ICacheConfig { adapter?: string; enable?: boolean; logDebug?: boolean; keyPrefix?: string; options?: { url?: string; ttl?: number; }; } export default class Cache extends SpruceSkillService { private cache?; private isEnabled; private logDebug; constructor(options: { ctx: ISpruceContext; config?: ICacheConfig; }); init(config?: ICacheConfig): void; /** * Save to the cache * * @param key The key you want to cache against * @param value The value to cache * @param ttl The time-to-live in seconds */ set(key: string, value: any, ttl?: number): void; /** * Save to the cache with the ability to wait for the operation to complete * * @param key The key you want to cache against * @param value The value to cache * @param ttl The time-to-live in seconds */ setAsync(key: string, value: any, ttl?: number): Promise; /** * Get an item from the cache * * @param key The cache key to fetch */ get(key: string): Promise; /** * Delete an item from the cache * * @param key The key of the item to delete */ del(key: string): void; /** * Delete an item from the cache with the ability to wait for the operation to complete * * @param key The key of the item to delete */ delAsync(key: string): Promise; /** * Delete any items from the cache that match the key. * For example, to delete any key that starts with "mySkill" you'd * set key='mySkill*' * * @param key The key of the item to delete */ delWildcard(key: string): Promise; /** * Delete any items from the cache that match the key. And wait for * the operation to complete. * For example, to delete any key that starts with "mySkill" you'd * set key='mySkill*' * * @param key The key of the item to delete */ delWildcardAsync(key: string): Promise; /** * Whether the cache is connected */ isConnected(): boolean; private debugLog; private setAdapter; } export {};