redis 127.0.0.1:6379> SET name "itheima"
OK
redis 127.0.0.1:6379> GET name
"itheima"
redis> HMSET myhash field1 "Hello" field2 "World"
"OK"
redis> HGET myhash field1
"Hello"
redis> HGET myhash field2
"World"
127.0.0.1:6379> lpush myList a
127.0.0.1:6379> lpush myList b
127.0.0.1:6379> rpush myList c
127.0.0.1:6379> lrange myList 0 -1
"b"
"a"
"c"
127.0.0.1:6379> sadd myset a
127.0.0.1:6379> sadd myset b
127.0.0.1:6379> smembers myset
"a"
"b"
127.0.0.1:6379> zadd mysort 60 zhangsan
127.0.0.1:6379> zadd mysort 50 lisi
127.0.0.1:6379> zadd mysort 80 wangwu
127.0.0.1:6379> zrange mysort 0 -1
"lisi"
"zhangsan"
"wangwu"
127.0.0.1:6379> zrange mysort 0 -1 withscores
"zhangsan"
"60"
"wangwu"
"80"
"lisi"
"500"
127.0.0.1:6379> subscribe itheima_chat
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "itheima_chat"
3) (integer) 1
127.0.0.1:6379> publish itheima_chat "good good study"
(integer) 2
127.0.0.1:6379> publish itheima_chat "day day up"
(integer) 2
127.0.0.1:6379>
1) "message"
2) "itheima_chat"
3) "good good study"
1) "message"
2) "itheima_chat"
3) "day day up"
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |