# cachit

> A small, flexible, promisey, backend-agnostic caching helper function

Latest version **0.0.1** (published 2015-09-11) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install cachit
pnpm add cachit
yarn add cachit
bun add cachit
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2015-09-11 |
| First published | 2015-09-11 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | bjjb |
| Maintainers | bjjb |
| Keywords | cache |

## Links

- npm: https://www.npmjs.com/package/cachit
- Repository: https://github.com/bjjb/cachit.js
- Homepage: https://github.com/bjjb/cachit.js#readme
- Issues: https://github.com/bjjb/cachit.js/issues
- npm.io page: https://npm.io/package/cachit

## Dependencies (1)

- [bluebird](https://npm.io/package/bluebird.md) ~2.10.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2015-09-11

## README

# Cachit

A little backend-agnostic caching helper for JavaScript

## Installation (NodeJS)

    npm install cachit

## Usage

    var cachit, cache
    if (typeof(require) === 'function')
      cachit = require('cachit')
    else if (!!window)
      cachit = window.cachit
    cache = cachit()
    cache('foo', function() { console.log("Running foo!"); return "Foo." })
    cache('foo', function() { console.log("Running foo!"); return "Foo." })

The preceding code will print "Running foo!" just once, as the second time,
the return value of the function has been cached (in memory), and it will be
returned.

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