nisbos


向set添加一条记录

<p><strong>简要描述:</strong> </p> <ul> <li>向set添加一条记录</li> </ul> <p><strong>入参:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">key</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>存储redis中的唯一标识</td> </tr> <tr> <td style="text-align: left;">value</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>添加的数值</td> </tr> </tbody> </table> <p><strong>返回示例</strong></p> <pre><code> { 1 }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">无</td> <td style="text-align: left;">long</td> <td>是否储存成功(0/1)</td> </tr> </tbody> </table> <p><strong>示例代码</strong></p> <pre><code class="language-java">IRedisService redisService = ICacheUtil.service(); long lg1 = redisService.sadd("user", "erin"); long lg2 = redisService.sadd("user","xinxin"); long lg3 = redisService.sadd("user","ling"); System.out.println("lg1:"+lg1+"\nlg2:"+lg2+"\nlg3:"+lg3);</code></pre> <p><img src="https://www.showdoc.cc/server/api/common/visitfile/sign/e6557af3d9b4e79e4b910c9924d6bce5?showdoc=.jpg" alt="" /></p> <p>数据库中存储结构如下: <img src="https://www.showdoc.cc/server/api/common/visitfile/sign/d28501a0778fc968d66df181740dc5b6?showdoc=.jpg" alt="" /> <strong>接口</strong></p> <pre><code class="language-java">/* * 向set添加一条记录,如果member已经存在则返回0,否则返回1 */ public long sadd(String key,String member)throws CacheException;</code></pre> <p><strong>备注</strong> </p> <ul> <li>如果member已经存在则返回0,否则返回1</li> </ul>

页面列表

ITEM_HTML