Skip to content

Used for saving the caches of the CLI, which is convenient for the next execution.

License

Notifications You must be signed in to change notification settings

ouduidui/local-caches

Repository files navigation

local-caches

Used for saving the caches of the CLI, which is convenient for the next execution.

Usage

Install

npm install local-caches

Use

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.

Configs

interface CachesConfig {
  // the dirname of saving caches
  // default '.cache'
  pathName?: `.${string}`
  // the filename of saving caches
  // default 'index'
  fileName?: string
}

API

getCaches

Used for getting all caches in a specified configuration.

declare const getCaches: (config?: CachesConfig | undefined) => Record<string, string> | null

getCache

Used for getting a specified cache in a specified configuration.

declare const getCache: (key: string, config?: CachesConfig | undefined) => string | undefined

setCache

Used for setting cache in a specified configuration.

declare const setCache: (key: string, value: string, config?: CachesConfig | undefined) => void

removeCache

Used for removing a specified cache in a specified configuration.

declare const setCache: (key: string, value: string, config?: CachesConfig | undefined) => void

clearCaches

Use for clear all caches in a specified configuration.

declare const clearCaches: (config?: CachesConfig | undefined) => void

License

MIT License © 2022 Dewey Ou

About

Used for saving the caches of the CLI, which is convenient for the next execution.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published