Used for saving the caches of the CLI, which is convenient for the next execution.
npm install local-caches
import { getCache, setCache } from 'local-caches'
setCache('baz', 'foo')
const val = getCache('baz') // 'foo'
you can add ".cache/*" to your ".gitignore" file when you don't commit cache file.
interface CachesConfig {
// the dirname of saving caches
// default '.cache'
pathName?: `.${string}`
// the filename of saving caches
// default 'index'
fileName?: string
}
Used for getting all caches in a specified configuration.
declare const getCaches: (config?: CachesConfig | undefined) => Record<string, string> | null
Used for getting a specified cache in a specified configuration.
declare const getCache: (key: string, config?: CachesConfig | undefined) => string | undefined
Used for setting cache in a specified configuration.
declare const setCache: (key: string, value: string, config?: CachesConfig | undefined) => void
Used for removing a specified cache in a specified configuration.
declare const setCache: (key: string, value: string, config?: CachesConfig | undefined) => void
Use for clear all caches in a specified configuration.
declare const clearCaches: (config?: CachesConfig | undefined) => void