🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## sUnionStore ##### *Description* Performs the same action as sUnion, but stores the result in the first key 执行一个并集操作就和sUnion()一样,但是结果储存在第一个参数中。 ##### *Parameters* *Key*: dstkey, the key to store the diff into. 存储结果的SET集合KEY *Keys*: key1, key2, ... , keyN: Any number of keys corresponding to sets in redis. 求并集的KEYS ##### *Return value* *INTEGER*: The cardinality of the resulting set, or `<span class="calibre12">FALSE</span>` in case of a missing key. 返回整数值:并集结果的个数。 ##### *Example* ``` <pre class="calibre16">$redis->delete('s0', 's1', 's2'); $redis->sAdd('s0', '1'); $redis->sAdd('s0', '2'); $redis->sAdd('s1', '3'); $redis->sAdd('s1', '1'); $redis->sAdd('s2', '3'); $redis->sAdd('s2', '4'); var_dump($redis->sUnionStore('dst', 's0', 's1', 's2')); var_dump($redis->sMembers('dst')); ``` Return value: the number of elements that are either in s0 or in s1 or in s2. ``` <pre class="calibre16">int(4) array(4) { [0]=> string(1) "3" [1]=> string(1) "4" [2]=> string(1) "1" [3]=> string(1) "2" } ```