Skip to content

Commit 90c598a

Browse files
committed
add params to redis key
1 parent 3dc353c commit 90c598a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "loopback-redis-cache",
3-
"version": "1.0.10",
3+
"version": "1.0.11",
44
"description": "Redis cache for loopback.io",
55
"main": "rediscache.js",
66
"scripts": {

rediscache.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = function(Model, options) {
3131
var cachExpire = ctx.req.query.cache;
3232

3333
// set key name
34-
var cache_key = modelName+'_'+new Buffer(JSON.stringify(ctx.req.query)).toString('base64');
34+
var cache_key = modelName+'_'+new Buffer(JSON.stringify(ctx.req.params) + JSON.stringify(ctx.req.query)).toString('base64');
3535

3636
// search for cache
3737
client.get(cache_key, function(err, val) {
@@ -68,7 +68,7 @@ module.exports = function(Model, options) {
6868
var cachExpire = ctx.req.query.cache;
6969

7070
// set key name
71-
var cache_key = modelName+'_'+new Buffer(JSON.stringify(ctx.req.query)).toString('base64');
71+
var cache_key = modelName+'_'+new Buffer(JSON.stringify(ctx.req.params) + JSON.stringify(ctx.req.query)).toString('base64');
7272
// search for cache
7373
client.get(cache_key, function(err, val) {
7474
if(err){

0 commit comments

Comments
 (0)