# redis-memoize

> memoize function result in redis

Latest version **1.0.0** (published 2016-10-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install redis-memoize
pnpm add redis-memoize
yarn add redis-memoize
bun add redis-memoize
```

## 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.0 |
| Published | 2016-10-07 |
| First published | 2016-10-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| Author | Chakrit Likitkhajorn |
| Maintainers | chrisza-tw |

## Links

- npm: https://www.npmjs.com/package/redis-memoize
- Repository: https://github.com/chrisza4/redis-memoizer
- Homepage: https://github.com/chrisza4/TimingJs#readme
- Issues: https://github.com/chrisza4/TimingJs/issues
- npm.io page: https://npm.io/package/redis-memoize

## Dependencies (5)

- [uuid](https://npm.io/package/uuid.md) ^2.0.3
- [redis](https://npm.io/package/redis.md) ^2.6.2
- [bluebird](https://npm.io/package/bluebird.md) ^3.4.6
- [babel-cli](https://npm.io/package/babel-cli.md) ^6.14.0
- [babel-polyfill](https://npm.io/package/babel-polyfill.md) ^6.13.0

## Recent versions

- 1.0.0 (latest) — 2016-10-07

## README

# redis-memoizer

function memoizer by using redis cache

# Inspiration

Lodash memoizing have problem about memory leak states here:

http://stackoverflow.com/questions/38600119/is-the-default-lodash-memoize-function-a-danger-for-memory-leaks

So I write a new memoizer using redis and TTL to ensure memory not leaking

# How to use

```
npm install redis-memoizer
```

You can memoize function by using this pattern

```
function originalFunction () {
   return 555
} 
memoizer.connectRedis('redis://127.0.0.1:6379')
const memoizeFunc = memoizer.memoize(originalFunction)
const res1 = await memoizeFunc()
assert(res1 === 555)
```

Please beware that you cannot memoize
1. Anonymous function (will throw)
2. Functions with same name

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