sinterstore
1. 基本語法
sinterstore(destination
, key
, [key,...]
, callback
)
destination
, key
, [key,...]
, callback
) 功能類似sinter,主要差別在sinter直接回傳交集成員;而sinterstore將交集成員儲存到destination
集合中,並回傳交集的成員「數量」。
2. 範例
const arr1 = ['A', 'B', 'C'];
const arr2 = ['C', 'D', 'E'];
client.sadd('user:1:choice', arr1);
client.sadd('user:2:choice', arr2);
client.sinterstore('inter','user:1:choice', 'user:2:choice', redis.print);
client.smembers('inter', redis.print);
Reply: 1
Reply: C
Last updated
Was this helpful?