【问题标题】:Redis set operation optionsRedis 设置操作选项
【发布时间】:2016-01-19 06:00:52
【问题描述】:

我可以在 Redis 中以以下格式存储键和值吗? ※多个键和值关联一个全局唯一键↓。

Unique_Key Key_1  some_url_1
           Key_2  some_url_2
           Key_3  some_url_3
           Key_4  some_url_4
             |         |
             |         |

【问题讨论】:

    标签: redis


    【解决方案1】:

    是的,你需要使用hash(又名hash table)数据结构:

    hset unique_key key_1 some_url_1
    hset unique_key key_2 some_url_2
    

    或者

    hmset unique_key key_1 some_url_1 key_2 some_url_2
    

    检查Redis hash commands

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多