1. <i id='1S1OW'><tr id='1S1OW'><dt id='1S1OW'><q id='1S1OW'><span id='1S1OW'><b id='1S1OW'><form id='1S1OW'><ins id='1S1OW'></ins><ul id='1S1OW'></ul><sub id='1S1OW'></sub></form><legend id='1S1OW'></legend><bdo id='1S1OW'><pre id='1S1OW'><center id='1S1OW'></center></pre></bdo></b><th id='1S1OW'></th></span></q></dt></tr></i><div id='1S1OW'><tfoot id='1S1OW'></tfoot><dl id='1S1OW'><fieldset id='1S1OW'></fieldset></dl></div>

      <small id='1S1OW'></small><noframes id='1S1OW'>

        <bdo id='1S1OW'></bdo><ul id='1S1OW'></ul>

      <legend id='1S1OW'><style id='1S1OW'><dir id='1S1OW'><q id='1S1OW'></q></dir></style></legend>
      1. <tfoot id='1S1OW'></tfoot>

        你如何搜索带有值的键?例如,获取值为“someva

        时间:2023-10-04
        <tfoot id='9UFVG'></tfoot>
      2. <small id='9UFVG'></small><noframes id='9UFVG'>

          <tbody id='9UFVG'></tbody>
      3. <legend id='9UFVG'><style id='9UFVG'><dir id='9UFVG'><q id='9UFVG'></q></dir></style></legend>

      4. <i id='9UFVG'><tr id='9UFVG'><dt id='9UFVG'><q id='9UFVG'><span id='9UFVG'><b id='9UFVG'><form id='9UFVG'><ins id='9UFVG'></ins><ul id='9UFVG'></ul><sub id='9UFVG'></sub></form><legend id='9UFVG'></legend><bdo id='9UFVG'><pre id='9UFVG'><center id='9UFVG'></center></pre></bdo></b><th id='9UFVG'></th></span></q></dt></tr></i><div id='9UFVG'><tfoot id='9UFVG'></tfoot><dl id='9UFVG'><fieldset id='9UFVG'></fieldset></dl></div>
            • <bdo id='9UFVG'></bdo><ul id='9UFVG'></ul>

                  本文介绍了你如何搜索带有值的键?例如,获取值为“somevalue"的所有 KEYS;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                     redis> SMEMBERS CO:1:A
                      1) "1"
                      2) "2"
                  
                     redis> SMEMBERS CO:2:A
                      1) "1"
                      2) "5"
                      3) "6"
                  
                     redis> SMEMBERS CO:3:A
                      1) "5"
                  
                     redis> SMEMBERS CO:4:A
                      1) "1"
                  

                  现在我想找到值1存在的键

                  Now I want to find the keys where the value 1 exist

                  如果我使用值 1 进行搜索,那么结果键将是 CO:1:A, CO:2:ACO:4:A

                  If I search with the values 1 then the result keys will be CO:1:A, CO:2:A and CO:4:A

                  如何获得?

                  推荐答案

                  Redis 不是关系数据库.你需要预测这个访问路径,并维护一个反向索引.

                  Redis is not a relational database. You need to anticipate this access path, and maintain a reverse index.

                  # This is your index
                  SADD CO:1:A 1 2
                  SADD CO:2:A 1 5 6
                  SADD CO:3:A 5
                  SADD CO:4:A 1
                  
                  # Here is the reverse index
                  SADD REV:1 1 2 4
                  SADD REV:2 1
                  SADD REV:5 2 3
                  SADD REV:6 2
                  

                  现在可以反向查询了:

                  SMEMBERS REV:1
                  1) "1"
                  2) "2"
                  3) "4"
                  ... meaning CO:1:A. CO:2:A, CO:4:A
                  

                  这篇关于你如何搜索带有值的键?例如,获取值为“somevalue"的所有 KEYS;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Laravel 5.2 - 如何从用户的所有设备上注销 下一篇:带有 laravel 5.5 的 Predis“Aggregate/RedisCluster.php:33

                  相关文章

                  最新文章

                  1. <tfoot id='IkpG3'></tfoot>
                    <i id='IkpG3'><tr id='IkpG3'><dt id='IkpG3'><q id='IkpG3'><span id='IkpG3'><b id='IkpG3'><form id='IkpG3'><ins id='IkpG3'></ins><ul id='IkpG3'></ul><sub id='IkpG3'></sub></form><legend id='IkpG3'></legend><bdo id='IkpG3'><pre id='IkpG3'><center id='IkpG3'></center></pre></bdo></b><th id='IkpG3'></th></span></q></dt></tr></i><div id='IkpG3'><tfoot id='IkpG3'></tfoot><dl id='IkpG3'><fieldset id='IkpG3'></fieldset></dl></div>

                      <small id='IkpG3'></small><noframes id='IkpG3'>

                      <legend id='IkpG3'><style id='IkpG3'><dir id='IkpG3'><q id='IkpG3'></q></dir></style></legend>
                        <bdo id='IkpG3'></bdo><ul id='IkpG3'></ul>