diff --git a/lib/commands.json b/lib/commands.json index 06f1b02..36dccb9 100644 --- a/lib/commands.json +++ b/lib/commands.json @@ -2005,6 +2005,16 @@ "keyStop": -1, "step": 1 }, + "sdiffcard": { + "arity": -3, + "flags": [ + "readonly", + "movablekeys" + ], + "keyStart": 0, + "keyStop": 0, + "step": 0 + }, "sdiffstore": { "arity": -3, "flags": [ @@ -2301,6 +2311,16 @@ "keyStop": -1, "step": 1 }, + "sunioncard": { + "arity": -3, + "flags": [ + "readonly", + "movablekeys" + ], + "keyStart": 0, + "keyStop": 0, + "step": 0 + }, "sunionstore": { "arity": -3, "flags": [ diff --git a/lib/index.ts b/lib/index.ts index 97ad893..81ae860 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -122,7 +122,9 @@ export function getKeyIndexes( case "bzmpop": keys.push(...takeDynamicKeys(args, 1)); break; + case "sdiffcard": case "sintercard": + case "sunioncard": case "lmpop": case "zunion": case "zinter": diff --git a/test/index.js b/test/index.js index 38a36f8..f250815 100644 --- a/test/index.js +++ b/test/index.js @@ -215,6 +215,29 @@ describe('redis-commands', () => { expect(index('zintercard', ['2', 'key1', 'key2'])).to.eql([1, 2]) }) + it('handles sdiffcard', () => { + expect(index('sdiffcard', ['1', 'key1'])).to.eql([1]) + expect(index('sdiffcard', [2, 'key1', 'key2'])).to.eql([1, 2]) + expect( + index('sdiffcard', ['2', 'key1', 'key2', 'LIMIT', '1']) + ).to.eql([1, 2]) + }) + + it('handles sunioncard', () => { + expect(index('sunioncard', ['1', 'key1'])).to.eql([1]) + expect(index('sunioncard', [2, 'key1', 'key2'])).to.eql([1, 2]) + expect( + index('sunioncard', [ + '2', + 'key1', + 'key2', + 'APPROX', + 'LIMIT', + '1' + ]) + ).to.eql([1, 2]) + }) + it('handles lmpop', () => { expect( index('lmpop', ['2', 'key1', 'key2', 'left', 'count', 10])