# local-caches

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

Latest version **1.0.0** (published 2022-10-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install local-caches
pnpm add local-caches
yarn add local-caches
bun add local-caches
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-10-05 |
| First published | 2022-10-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dewey Ou |
| Maintainers | ouduidui |

## Links

- npm: https://www.npmjs.com/package/local-caches
- Repository: https://github.com/ouduidui/local-caches
- Homepage: https://github.com/ouduidui/local-caches#readme
- Issues: https://github.com/ouduidui/local-caches/issues
- npm.io page: https://npm.io/package/local-caches

## Recent versions

- 1.0.0 (latest) — 2022-10-05
- 0.0.0 — 2022-10-05

## README

<h1 align="center"><samp>local-caches</samp></h1>

<p align="center">
  <samp>Used for saving the caches of the CLI, which is convenient for the next execution.</samp>
</p>

## Usage

### Install

```
npm install local-caches
```

### Use

```ts
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

```ts
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.

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

### getCache

Used for getting a specified cache in a specified configuration.

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

### setCache

Used for setting cache in a specified configuration.

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

### removeCache

Used for removing a specified cache in a specified configuration.

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

### clearCaches

Use for clear all caches in a specified configuration.

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


## License

[MIT](./LICENSE) License © 2022 [Dewey Ou](https://github.com/ouduidui)

---
_Source: https://npm.io/package/local-caches · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
