From 037e200b44deeb08cc0cae0e12fe6ffda48dcfa1 Mon Sep 17 00:00:00 2001 From: Akhil B Date: Wed, 31 Jul 2019 09:22:54 -0400 Subject: [PATCH 1/2] Update README.md When not using the default cache store, the read/write functions should use BJSON. Similar, to how it has been done with the default read/write functions. Not using BJSON(buffer-json) throws errors with raw loaders. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 18aeab6..f626ccb 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ module.exports = { // Or different database client - memcached, mongodb, ... const redis = require('redis'); const crypto = require('crypto'); - +const BJSON = require("buffer-json"); // ... // connect to client // ... @@ -117,7 +117,7 @@ function read(key, callback) { } try { - let data = JSON.parse(result); + let data = BJSON.parse(result); callback(null, data); } catch (e) { callback(e); @@ -127,7 +127,7 @@ function read(key, callback) { // Write data to database under cacheKey function write(key, data, callback) { - client.set(key, JSON.stringify(data), 'EX', BUILD_CACHE_TIMEOUT, callback); + client.set(key, BJSON.stringify(data), 'EX', BUILD_CACHE_TIMEOUT, callback); } module.exports = { From 530f0756ef93edf18024950f587c15b9a240403e Mon Sep 17 00:00:00 2001 From: Akhil B Date: Tue, 13 Aug 2019 09:14:49 -0400 Subject: [PATCH 2/2] Fix linting Co-Authored-By: Tiago Costa --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f626ccb..a89d3df 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ module.exports = { // Or different database client - memcached, mongodb, ... const redis = require('redis'); const crypto = require('crypto'); -const BJSON = require("buffer-json"); +const BJSON = require('buffer-json'); // ... // connect to client // ...