多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 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" } ```