<commit_before># cachetree-redis [![Build Status](https://secure.travis-ci.org/davidwood/cachetree-redis.png)](http://travis-ci.org/davidwood/cachetree-redis)

A Redis storage backend for [Cachetree](https://github.com/davidwood/cachetree).

## Installation

    npm install cachetree-redis

## Usage

To create a Cachtree instance using a Redis storage backend:

```
var cachetreeRedis = require('cachetree-redis'),
    cachetree = require('cachetree),
    store = cachetreeRedis(),
    cache = cachetree(store);
```

The `cachetree-redis` module exports a single constructor function that accepts an optional options object and returns a Redis storage backend instance.

`cachetreeRedis(options)`

* `options`: An object containing the following configuration options:
    * `client`: Redis client instance. If provided, `port`, `host`, `options`, `pw` and `db` are ignored
    * `port`: Redis server port
    * `host`: Redis server host
    * `options`: [Redis client](https://github.com/mranney/node_redis) options passed to `redis.createClient`
    * `pw`: Password for authenticating with Redis
    * `pass`: Alias for `pw`, if you're not a fan of the whole brevity thing
    * `password`: Alias for `pw`, same as `pass`
    * `db`: Number of the database to select
    * `database`: Alias for `db`
    * `delimiter`: Redis key delimiter, defaults to `:`
    * `autoCast`: Automatically stringify and parse values, defaults to `true` 

The returned store exposes the underlying Redis client through a property named `client`.

## Running Tests

`cachetree-redis` tests require [Mocha](http://visionmedia.github.com/mocha/) and can be run with either `npm test` or `make test`.  You can specify Mocha options, such as the reporter, by adding a [mocha.opts](http://visionmedia.github.com/mocha/#mocha.opts) file, which is ignored by git, to the `test` directory.
<commit_msg>Update Mocha link<commit_after># cachetree-redis [![Build Status](https://secure.travis-ci.org/davidwood/cachetree-redis.png)](http://travis-ci.org/davidwood/cachetree-redis)

A Redis storage backend for [Cachetree](https://github.com/davidwood/cachetree).

## Installation

    npm install cachetree-redis

## Usage

To create a Cachtree instance using a Redis storage backend:

```
var cachetreeRedis = require('cachetree-redis'),
    cachetree = require('cachetree),
    store = cachetreeRedis(),
    cache = cachetree(store);
```

The `cachetree-redis` module exports a single constructor function that accepts an optional options object and returns a Redis storage backend instance.

`cachetreeRedis(options)`

* `options`: An object containing the following configuration options:
    * `client`: Redis client instance. If provided, `port`, `host`, `options`, `pw` and `db` are ignored
    * `port`: Redis server port
    * `host`: Redis server host
    * `options`: [Redis client](https://github.com/mranney/node_redis) options passed to `redis.createClient`
    * `pw`: Password for authenticating with Redis
    * `pass`: Alias for `pw`, if you're not a fan of the whole brevity thing
    * `password`: Alias for `pw`, same as `pass`
    * `db`: Number of the database to select
    * `database`: Alias for `db`
    * `delimiter`: Redis key delimiter, defaults to `:`
    * `autoCast`: Automatically stringify and parse values, defaults to `true` 

The returned store exposes the underlying Redis client through a property named `client`.

## Running Tests

`cachetree-redis` tests require [Mocha](https://mochajs.org/) and can be run with either `npm test` or `make test`.  You can specify Mocha options, such as the reporter, by adding a [mocha.opts](https://mochajs.org/#mochaopts) file, which is ignored by git, to the `test` directory.

{'fraction_non_alphanumeric': 0.11826226870474658, 'fraction_numerical': 0.0, 'mean_word_length': 4.390173410404624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6376371', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1094, 'n_words': 400}