UNPKG

@snail-js/api

Version:

Http Request with Decorators Api, build on axios

26 lines (25 loc) 740 B
import { AdapterConstructor } from "./cache.type"; export declare enum CacheType { Memory = 0, IndexDB = 1, LocalStorage = 2, Custom = 3 } export type MemoryCacheOption = { type: CacheType.Memory; } & CacheCommonOption; export type IndexDBCacheOption = { type: CacheType.IndexDB; } & CacheCommonOption; export type LocalStorageCacheOption = { type: CacheType.LocalStorage; } & CacheCommonOption; export type CustomCacheOption = { type: CacheType.Custom; adapter: AdapterConstructor; options?: any; } & CacheCommonOption; export interface CacheCommonOption { ttl?: number; } export type CacheManagementOption = MemoryCacheOption | IndexDBCacheOption | LocalStorageCacheOption | CustomCacheOption;