@melchyore/adonis-cache
Version:
Cache package for AdonisJS V5
32 lines (31 loc) • 853 B
TypeScript
import { CacheStores, CacheEventsConfig } from '@ioc:Adonis/Addons/Cache';
/**
* Expected shape of the config accepted by the "cacheConfig"
* method
*/
declare type CacheConfig = {
prefix: string;
stores: {
[name: string]: {
[K in keyof CacheStores]: CacheStores[K]['config'] & {
driver: K;
};
}[keyof CacheStores];
};
ttl: number;
events: CacheEventsConfig;
};
/**
* Define config for cache
*/
export declare function cacheConfig<T extends CacheConfig & {
store: keyof T['stores'];
}>(config: T): T;
/**
* Pull stores from the config defined inside the "config/cache.ts"
* file
*/
export declare type InferStoresFromConfig<T extends CacheConfig> = {
[K in keyof T['stores']]: CacheStores[T['stores'][K]['driver']];
};
export {};