Unknown SDK

sinterstore

Computes the intersection of the provided sets of unique values, and stores the result in a destination key.

If the destination key already exists, it is overwritten.

[Redis documentation]

Arguments

Copied to clipboard!
sinterstore(dest, keys, [options]);

Arguments Type Description
dest
string
Destination key
keys
string[]
List of set keys to intersect
options
object
Optional query arguments

options

The options arguments can contain the following option properties:

Property Type (default) Description
queuable
boolean (true)
If true, queues the request during downtime, until connected to Kuzzle again

Resolve

Resolves to the number of stored values.

Usage

Copied to clipboard!
try {
  await kuzzle.ms.sadd('set1', ['foo', 'bar', 'hello']);
  await kuzzle.ms.sadd('set2', ['world', 'baz', 'foo']);
  // Prints: 1
  console.log(await kuzzle.ms.sinterstore('dest', ['set1', 'set2']));
  // Prints: [ 'foo' ]
  console.log(await kuzzle.ms.smembers('dest'));
} catch (error) {
  console.error(error.message);
}