gbcmakehsht

导航

Redis

1

127.0.0.1:6379[1]> HSET student1 stuName '刘河飞'

127.0.0.1:6379[1]> HSET student1 stuID 20180001

127.0.0.1:6379[1]> HSET student1 age 22

127.0.0.1:6379[1]> HSET student1 sex ''

127.0.0.1:6379[1]> HSET student1 height 171

127.0.0.1:6379[1]> HSET student1 weight 75

127.0.0.1:6379[1]> HSET student1 birthday 1996-02-14

127.0.0.1:6379[1]> HSET student1 className '软件工程1'

2

127.0.0.1:6379[1]> HMSET student2 stuName '赵雨梦' stuID 20181762 age 24 sex '' height

175 weight 73 birthday '1994-04-23' className '网络工程1'

127.0.0.1:6379[1]> HMSET student3 stuName '宋飞' stuID 20180023 age 23 sex '' height

168 weight 67 birthday '1995-08-18' className '软件工程2'

 

127.0.0.1:6379[1]> HMSET student4 stuName '陈慧' stuID 20181120 age 23 sex '' height

170 weight 64 birthday '1995-03-15' className '信息管理1'

 

127.0.0.1:6379[1]> HMSET student5 stuName '孙玉' stuID 20180097 age 22 sex '' height

166 weight 63 birthday '1996-09-10' className '软件工程2'

3

HGET student2 age HGET student2 birthday

4

HGETALL student2

5

HMGET student3 stuName stuID age birthday className

6

HKEYS student1

7

HVALS student1

8

HLEN student1

9

HLEN student1

10

HINCRBY student1 age 3

HINCRBY student1 height 3

HINCRBY student1 className 3

11

HINCRBYFLOAT student1 height 3.56

12

HDEL student5 weight HDEL student5 className

13

HEXISTS student5 age HEXISTS student5 className

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

redis-cli SADD cities1 北京 上海 广州 深圳 杭州 苏州 南京 成都  
redis-cli SADD cities2 昆明 哈尔滨 济南 厦门 合肥 佛山 南昌 兰州  
redis-cli SADD cities3 银川 丽江 保定 三亚 桂林 襄阳

redis-cli SMOVE cities2 cities1 昆明

redis-cli SUNIONSTORE cities cities1 cities2 cities3

redis-cli SISMEMBER cities 北京  
redis-cli SISMEMBER cities2 北京

redis-cli SCARD cities  
redis-cli SCARD cities1

redis-cli SMEMBERS cities

redis-cli SPOP cities

redis-cli SMEMBERS cities  
redis-cli SMEMBERS cities1  
redis-cli SMEMBERS cities2  
redis-cli SMEMBERS cities3

redis-cli SDIFF cities1 cities2

redis-cli SDIFFSTORE cities4 cities cities1 cities2 cities3  
redis-cli SDIFFSTORE cities5 cities cities3

redis-cli SINTER cities cities4  
redis-cli SINTER cities cities1 cities2

redis-cli SREM cities5 杭州 深圳

# 注意:Redis 没有直接随机删除多个元素的命令,可以通过 SPOP 命令多次执行达到效果  
redis-cli SPOP cities5  
redis-cli SPOP cities5

posted on 2024-04-02 21:04  柚子湖  阅读(9)  评论(0编辑  收藏  举报