express-redis-cache2
Advanced tools
Comparing version
CHANGE LOG | ||
========== | ||
# 2.0.0-beta5 | ||
This release fixes the constructor function. | ||
# v2.0.0-beta4 | ||
This release improves documentation. | ||
# v2.0.0-beta3 | ||
@@ -8,0 +13,0 @@ |
@@ -17,2 +17,6 @@ module.exports = (function () { | ||
if ( !options || !options.client || typeof options.client !== 'object' ) { | ||
return this.emit('error', new Error('Missing options.client')); | ||
} | ||
/** The request options | ||
@@ -23,3 +27,3 @@ * | ||
this.options = options || {}; | ||
this.options = options; | ||
@@ -54,3 +58,3 @@ /** The entry name prefix | ||
this.connected = !!this.options.client; | ||
this.connected = false; | ||
@@ -73,3 +77,3 @@ /** The Redis Client | ||
this.connected = true; | ||
this.emit('connected', { host: this.host, port: this.port }); | ||
this.emit('connected'); | ||
this.emit('message', 'OK connected to redis://' + this.client.address); | ||
@@ -80,4 +84,4 @@ }.bind(this)); | ||
this.connected = false; | ||
this.emit('disconnected', { host: this.host, port: this.port }); | ||
this.emit('message', 'Disconnected from redis://' + this.client.host + ':' + this.client.port); | ||
this.emit('disconnected'); | ||
this.emit('message', 'Disconnected from redis://' + this.client.address); | ||
}.bind(this)); | ||
@@ -84,0 +88,0 @@ } |
{ | ||
"name": "express-redis-cache2", | ||
"version": "2.0.0-beta4", | ||
"version": "2.0.0-beta5", | ||
"description": "A module to make Express interact with Redis (create, get, delete). You can automatically cache all your most popular routes in Redis.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -48,6 +48,6 @@ # Express Redis Cache 2 | ||
const redis = require('redis'); | ||
const createRedisCache = require('express-redis-cache2'); | ||
const createExpressRedisCache = require('express-redis-cache2'); | ||
const client = redis.createClient(); | ||
const cache = createRedisCache({ client }); | ||
const cache = createExpressRedisCache({ client }); | ||
const app = express(); | ||
@@ -158,7 +158,7 @@ | ||
const redis = require('redis'); | ||
const createRedisCache = require('express-redis-cache2'); | ||
const createExpressRedisCache = require('express-redis-cache2'); | ||
const client = redis.createClient(); | ||
// Set default prefix to "test". All entry names will begin by "test:" | ||
const cache = createRedisCache({ | ||
const cache = createExpressRedisCache({ | ||
client, | ||
@@ -198,7 +198,7 @@ prefix: 'test', | ||
const redis = require('redis'); | ||
const createRedisCache = require('express-redis-cache2'); | ||
const createExpressRedisCache = require('express-redis-cache2'); | ||
const client = redis.createClient(); | ||
// Set default lifetime to 60 seconds for all entries | ||
const cache = createRedisCache({ client, expire: 60 }); | ||
const cache = createExpressRedisCache({ client, expire: 60 }); | ||
``` | ||
@@ -205,0 +205,0 @@ |
42938
0.33%740
0.41%