-
四类NoSQL数据库比较
查看全部 -
常见的NoSQL<br/>查看全部
-
为什么需要NoSQL
查看全部 -
什么是NoSQL
查看全部 -
Redis 事务
172.17.0.2:6379> set num 1 OK 172.17.0.2:6379> get num "1" 172.17.0.2:6379> incr num (integer) 2 172.17.0.2:6379> get num "2" 172.17.0.2:6379> multi OK 172.17.0.2:6379> incr num QUEUED 172.17.0.2:6379> incr num QUEUED 172.17.0.2:6379> exec 1) (integer) 3 2) (integer) 4
172.17.0.2:6379> set user tom OK 172.17.0.2:6379> get user "tom" 172.17.0.2:6379> multi OK 172.17.0.2:6379> set user jerry QUEUED 172.17.0.2:6379> discard OK 172.17.0.2:6379> get user "tom"
查看全部 -
多数据库
172.17.0.2:6379> select 1 OK 172.17.0.2:6379[1]> keys * (empty array) 172.17.0.2:6379[1]> select 0 OK 172.17.0.2:6379> keys * 1) "myb1" 2) "num" 3) "myhash" 4) "mylist6" 5) "mylist" 6) "mya2" 7) "mylist2" 8) "mylist5" 9) "mylist4" 10) "myb3" 11) "num2" 12) "name" 13) "num4" 14) "mylist3" 15) "num3" 16) "num5" 17) "myset" 18) "mya1" 19) "myb2" 20) "mya3" 21) "mysort" 172.17.0.2:6379> move myset 1 (integer) 1 172.17.0.2:6379> select 1 OK 172.17.0.2:6379[1]> keys * 1) "myset" 172.17.0.2:6379[1]> type myset set
查看全部 -
相关特性:
多数据库
Redis 事务
查看全部 -
172.17.0.2:6379> type newcompany string 172.17.0.2:6379> type mylist list 172.17.0.2:6379> type myset set 172.17.0.2:6379> type myhash hash 172.17.0.2:6379> type mysort zset
查看全部 -
172.17.0.2:6379> expire newcompany 1000 (integer) 1 172.17.0.2:6379> ttl newcompany (integer) 994
查看全部 -
172.17.0.2:6379> get company "baidu" 172.17.0.2:6379> rename company newcompany OK 172.17.0.2:6379> get company (nil) 172.17.0.2:6379> get newcompany "baidu"
查看全部 -
172.17.0.2:6379> del my1 my2 my3 (integer) 3 172.17.0.2:6379> exists my1 (integer) 0 172.17.0.2:6379> exists mya1 (integer) 1
查看全部 -
172.17.0.2:6379> keys * 1) "mya1" 2) "num" 3) "mylist6" 4) "mya3" 5) "my1" 6) "num3" 7) "company" 8) "num2" 9) "my3" 10) "mylist2" 11) "myhash" 12) "num4" 13) "mylist4" 14) "name" 15) "myb2" 16) "myset" 17) "my2" 18) "mylist5" 19) "myb1" 20) "myb3" 21) "mya2" 22) "mylist" 23) "mysort" 24) "mylist3" 25) "num5" 172.17.0.2:6379> keys my? 1) "my1" 2) "my3" 3) "my2"
查看全部 -
Sorted-Set 使用场景
如大型在线游戏积分排行榜
构建索引数据
查看全部 -
扩展命令
172.17.0.2:6379> zadd mysort 70 zs 80 ls 90 ww (integer) 3 172.17.0.2:6379> zrangebyscore mysort 0 100 1) "zs" 2) "ls" 3) "ww" 172.17.0.2:6379> zrangebyscore mysort 0 100 withscores 1) "zs" 2) "70" 3) "ls" 4) "80" 5) "ww" 6) "90" 172.17.0.2:6379> zrangebyscore mysort 0 100 withscores limit 0 2 1) "zs" 2) "70" 3) "ls" 4) "80" 172.17.0.2:6379> zincrby mysort 3 ls "83" 172.17.0.2:6379> zscore mysort ls "83" 172.17.0.2:6379> zcount mysort 80 90 (integer) 2
查看全部 -
范围查询
172.17.0.2:6379> zadd mysort 85 jack 95 rose (integer) 2 172.17.0.2:6379> zrange mysort 0 -1 1) "ls" 2) "jack" 3) "rose" 4) "zs" 172.17.0.2:6379> zrange mysort 0 -1 withscores 1) "ls" 2) "80" 3) "jack" 4) "85" 5) "rose" 6) "95" 7) "zs" 8) "100" 172.17.0.2:6379> zrevrange mysort 0 -1 withscores 1) "zs" 2) "100" 3) "rose" 4) "95" 5) "jack" 6) "85" 7) "ls" 8) "80" 172.17.0.2:6379> zremrangebyrank mysort 0 4 (integer) 4 172.17.0.2:6379> zadd mysort 80 zs 90 ls 100 ws (integer) 3 172.17.0.2:6379> zremrangebyscore mysort 80 100 (integer) 3 172.17.0.2:6379> zrange mysort 0 -1 (empty array)
查看全部
举报
0/150
提交
取消