adonis5-cache
Version:
Cache provider for AdonisJS 5
20 lines (19 loc) • 1.17 kB
TypeScript
import { CacheContextContract, CacheStorageContract, TaggableStorageContract } from '@ioc:Adonis/Addons/Adonis5-Cache';
import { AdonisMemcachedClientContract } from '@ioc:Adonis/Addons/Adonis5-MemcachedClient';
export default class MemcachedStorage implements CacheStorageContract, TaggableStorageContract {
protected memcachedClient: AdonisMemcachedClientContract;
constructor(memcachedClient: AdonisMemcachedClientContract);
get<T = any>(context: CacheContextContract, key: string): Promise<T | null>;
getMany<T = any>(context: CacheContextContract, keys: string[]): Promise<(T | null)[]>;
put<T = any>(context: CacheContextContract, key: string, value: T, ttl: number): Promise<void>;
putMany<T = any>(context: CacheContextContract, cacheDictionary: {
[p: string]: T;
}, ttl: number): Promise<void>;
flush(): Promise<void>;
forget(key: string): Promise<boolean>;
addTag(tag: string, tagData: string): Promise<void>;
readTag(tag: string): Promise<string[]>;
removeTag(tag: string): Promise<void>;
protected buildMemcachedTagName(userTagName: string): string;
resolveTtl(ttlInMl: number): number;
}