bookshelf-cache-redis
Advanced tools
Comparing version
{ | ||
"name": "bookshelf-cache-redis", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "A robust, performance-focused caching solution for Bookshelf based on top of Redis.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -72,6 +72,3 @@ /** | ||
if (!serial || disabled === true) { | ||
return await this.constructor.forge()[method](options) | ||
.then(data => { | ||
return data.toJSON(); | ||
}); | ||
return await this[method](options); | ||
} | ||
@@ -82,6 +79,4 @@ | ||
if (result === null) { | ||
const cache = await this.constructor.forge()[method](options) | ||
.then(data => { | ||
return data.toJSON(); | ||
}) | ||
const cache = await this[method](options) | ||
.then(data => data.toJSON()); | ||
@@ -91,6 +86,10 @@ // Store record | ||
return cache; | ||
return ({ | ||
toJSON: () => cache | ||
}); | ||
} | ||
return JSON.parse(result); | ||
return ({ | ||
toJSON: () => JSON.parse(result) | ||
}); | ||
}); | ||
@@ -150,13 +149,2 @@ } | ||
}; | ||
bookshelf.Model.prototype.cache = function () { | ||
console.log(this); | ||
return this; | ||
} | ||
bookshelf.Model.cache = function (...args) { | ||
console.log(this); | ||
return this; | ||
} | ||
}; |
7380
-3.3%123
-6.82%