# src

> Simple Redis Cache

Latest version **1.1.2** (published 2014-02-22) · MIT license · 0 weekly downloads

## Install

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

## 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.1.2 |
| Published | 2014-02-22 |
| First published | 2012-12-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Will S. Laurance |
| Maintainers | wlaurance |
| Keywords | Simple, Redis, Cache |

## Links

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

## Dependencies (3)

- [uuid](https://npm.io/package/uuid.md) ~1.4.1
- [redis-url](https://npm.io/package/redis-url.md) ~0.2.0
- [underscore](https://npm.io/package/underscore.md) ~1.6.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

- 1.1.2 (latest) — 2014-02-22
- 1.1.1 — 2014-02-22
- 1.1.0 — 2014-02-22
- 1.0.0 — 2014-02-20
- 0.1.0 — 2012-12-11

## README

src
===

Simple Redis Cache
[![Build Status](https://travis-ci.org/wlaurance/src.png)](https://travis-ci.org/wlaurance/src)

###Usage

src takes one hash parameter with url and expiry defined. Expiry is the
number of seconds a value is non expired in Redis.

```javascript
var src = require('src');
var cache = src(
  {
    url:'redis://user:password@example.com:9073/'
    ,expiry:2
  }
);
```
Callbacks for set are optional
```javascript
cache.set('key', 'value', [cb]);
```
get requires a callback
```javascript
cache.get('key', function(err, value){
  if(typeof value !== 'undefined')
    console.log(value);
});
```
If the key has expired, err will not be used to determine this. Err will
only be a non null value when an error is thrown from Redis.

If you want to delete a key from the cache explicity src provides this
functionality through ```cache.del```

Callbacks are optional for del
```javascript
cache.del('key', [cb]);
```

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