# cachelee

> A fast caching mechanism for NodeJS applications.

Latest version **1.0.4** (published 2018-02-14) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-02-14 |
| First published | 2018-02-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 56.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kfir Marouani |
| Maintainers | kfir.marouani |
| Keywords | cache, caching |

## Links

- npm: https://www.npmjs.com/package/cachelee
- Repository: https://github.com/kfirm/cachelee
- Issues: https://github.com/kfirm/cachelee/issues
- npm.io page: https://npm.io/package/cachelee

## Dependencies (1)

- [linkedlee](https://npm.io/package/linkedlee.md) ^1.4.2

## 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

- 1.0.4 (latest) — 2018-02-14
- 1.0.3 — 2018-02-14
- 1.0.2 — 2018-02-11
- 1.0.1 — 2018-02-11
- 1.0.0 — 2018-02-11

## README

# Cachlee
A fast caching mechanism for NodeJS applications

# Install
 
 ```$xslt
 npm install --save cachelee
```

 
 # Usage
 
 You can set some options for caching by giving it a setting object with the following possible properties:
 
 | Property      | Value         | Default  |
 | ------------- |:-------------:| --------:|
 | limit         | numeric       |   1000   |
 | strategy      | LRU/LFU       |    LFU   |
 
 
 
 # API
 
 **cacheManager.cache(key, value)** - add to cache with key and value. Note that the key could be anything (string, object etc.)    
 **cacheManager.get(key)** - get cached object by key. returns null of none existing    
 **cacheManager.size()** - get current size of the cache  
 **cacheManager.maxSize()** - get the max size set for the cache  
 **cacheManager.setStrategy(strategy)** - change the caching strategy. In this you have two possibilities: **LeastRecentlyUsed** (default) or **LeastFrequentlyUsed**. (see example below)
 
 ```$xslt
var cachelee = require('cachelee');

var cacheManager = new cachelee.Cache( {   limit: 500, 
                                            strategy: cachelee.Strategy.LeastRecentlyUsed
                                        });

// add to cache by cacheManager.cache(KET, VALUE);
cacheManager.cache('A',{value: 'A'});
cacheManager.cache('B',{value: 'B'});
cacheManager.cache('C',{value: 'C'});

// extract from cache by cacheManager.get(KEY);

var aObj = cacheManager.get('A')

```

You can also change strategy by:

```$xslt
cacheManager.setStrategy(cachelee.Strategy.LeastFrequentlyUsed);
```

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