@silverwind/ioredis-mock
Version:
This library emulates ioredis by performing all operations in-memory.
22 lines (19 loc) • 675 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.makeStoreCommand = makeStoreCommand;
exports.makeStoreSetCommand = makeStoreSetCommand;
function makeStoreCommand(baseCommand, ResultType) {
return function (dest, ...args) {
const result = baseCommand.call(this, ...args);
this.data.set(dest, new ResultType(result));
return result.length;
};
}
function makeStoreSetCommand(baseCommand) {
return makeStoreCommand(baseCommand, Set);
} // @TODO: Bring this into zdiffstore, zinterstore, zrangestore, zunionstore
// export function makeStoreZSetCommand(baseCommand) {
// return makeStoreCommand(baseCommand, Map);
// }