Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/Tance.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ class Tance{
//console.info("cache MISS: ", searchId);
let returnVal = await fn.apply(fn, args);
let serializedReturnVal = serializationFn(returnVal);
if (typeof serializedReturnVal !== 'string') {
console.error(
`REDIS-TANCE: about to write a non-string, giving up. ` +
`Cache args: ${fn}, ${fnName}, ${serializationFn}, ${deserializationFn}, ${ignoreArgs} ` +
`Function args: ${JSON.stringify(args)}, ` +
`returnVal: ${JSON.stringify(returnVal)} ` +
`serializedReturnVal: ${typeof serializedReturnVal} ` + JSON.stringify(serializedReturnVal)
);
return returnVal;
}
await this.set(`${fnName}_${searchIdHash}`, serializedReturnVal, 'EX', durationInSeconds);
await this._indexItemOnEntry(args, fnName, `${fnName}_${searchIdHash}`, durationInSeconds);
await this.sadd(`${fnName}_keys`, `${fnName}_${searchIdHash}`);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redistance",
"version": "1.10.0",
"version": "1.10.1",
"description": "a collection of useful redis utilities",
"main": "index.js",
"dependencies": {
Expand Down