UNPKG

@melchyore/adonis-cache

Version:
32 lines (31 loc) 853 B
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 {};