Redis是什么
内存中的数据结KV构存储系统,常用作于高速缓存。
5种Redis数据结构的直观感受

对key的操作
127.0.0.1:6379> keys *
1) "ztan"
2) "ztan_key"
3) "website"
4) "app::users::click"
5) "redis-test"
6) "testkey"
7) "ztan tan"
8) "province"
127.0.0.1:6379> keys z*
1) "ztan"
2) "ztan_key"
3) "ztan tan"
127.0.0.1:6379> exists province
(integer) 1
127.0.0.1:6379> exists province2
(integer) 0
127.0.0.1:6379>
127.0.0.1:6379> APPEND test testvalue
(integer) 9
127.0.0.1:6379> keys *
1) "test"
2) "ztan_key"
3) "redis-test"
4) "testkey"
5) "ztan tan"
6) "ztan"
7) "website"
8) "app::users::click"
9) "province"
127.0.0.1:6379> del test
(integer) 1
127.0.0.1:6379> keys *
1) "ztan_key"
2) "redis-test"
3) "testkey"
4) "ztan tan"
5) "ztan"
6) "website"
7) "app::users::click"
8) "province"
127.0.0.1:6379>
对value(字符串)的操作
#查看key对应的value的类型
127.0.0.1:6379> type ztan
string
#查看key对应的value的值
127.0.0.1:6379> get ztan
"test"
127.0.0.1:6379>
对value(哈希)的操作
#查看key对应的value的类型
127.0.0.1:6379> type province
hash
#key对应的value是哈希,其实又是一个kv键值对,所以给定两个参数
127.0.0.1:6379> hget province ZheJiang
"2991091"
#返回key对应value里边的多个key对应的值
127.0.0.1:6379> hmget province ZheJiang JiangSu
1) "2991091"
2) "3026906"
127.0.0.1:6379>
#返回key对应的value里边的所有key
127.0.0.1:6379> hkeys province
1) "other"
2) "HeBei"
--后略---
#返回key对应的value里边的所有value
127.0.0.1:6379> hvals province
1) "0"
2) "2918391"
--后略---
#返回key对应的value里边的所有key和所有value
127.0.0.1:6379> hgetall province
1) "other"
2) "0"
3) "HeBei"
4) "2918391"
--后略---
参照资料
http://www.redis.cn/topics/data-types-intro.html