标签:sort key core 数组 ring 示例 字符 ash sadd
Redis 有 String,List,Set,Sorted Set,Hash 共 5 种数据类型
String:键 => 字符串
key => string
用法示例:
set key string
List:键 => 双向链表
key => [0 => string1 <-> 1 => string2 <-> 2 => string3 <-> ... ]
用法示例:
lpush key string1
lpush key string2
lset key index string1
Set:键 => 字符串无序集合
key => [string1, string2, string3, ... ]
用法示例:
sadd key string1
sadd key string2
Sorted Set:键 => 按数值(分数)排序的字符串集合
key => [string1 => score1, string2 => score2, ... ]
结构示例:
key => [string1 => 1, string2 => 3, string3 => 5, ... ]
用法示例:
zadd key 1 string1
zadd key 5 string3
Hash:键 => PHP数组,Java字典
key => [key_string1 => value_string1, key_string2 => value_string2, ... ]
用法示例:
hset key keystring1 value_string1
hget key keystring1
标签:sort key core 数组 ring 示例 字符 ash sadd
原文地址:https://www.cnblogs.com/lbnnbs/p/11565917.html