ioredis-mock
Version:
This library emulates ioredis by performing all operations in-memory.
15 lines (14 loc) • 316 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.incr = incr;
function incr(key) {
if (!this.data.has(key)) {
this.data.set(key, '0');
}
var curVal = Number(this.data.get(key));
var nextVal = curVal + 1;
this.data.set(key, nextVal.toString());
return nextVal;
}