3.0.0 • Published 7 years ago

cachetree-redis v3.0.0

Weekly downloads
45
License
-
Repository
github
Last release
7 years ago

cachetree-redis Build Status

A Redis storage backend for 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 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 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 file, which is ignored by git, to the test directory.

By default, the test suite uses fakeredis to mock a Redis server. To run the tests against an actual Redis server, add a JSON file named options.json to the test directory. This file should contain the options to be passed to the cachetree-redis constructor function. Like the mocha.opts file, options.json is ignored by git.

3.0.0

7 years ago

2.1.0

9 years ago

2.0.0

9 years ago

1.2.0

11 years ago

1.1.4

11 years ago

1.1.3

11 years ago

1.1.2

11 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago