redis笔记

1、教程
http://www.runoob.com/redis/redis-tutorial.html
redis数据类型: https://redis.io/topics/data-types

2、常用命令
官网: https://redis.io/commands

redis-cli  -h 110.120.119.995 -p 9895 -a 89 根据IP和端口链接远程redis-server, 密码为 -a 后的字符串,没密码可以不填-a选项
redis-cli  链接本地redis-server

FLUSHDB 删除当前数据库的所有key
DBSIZE 存储的key的数量

RANDOMKEY 随机返回一个key
KEYS pattern  查找符合指定模式的key (可能有些地方不支持)
GET
SET
EXPIRE  设置过期时间,单位为 秒
TTL     查询过期时间,单位为 秒

3、redis中的integer
官方介绍: https://redis.io/topics/protocol#integer-reply
redis中的integer存储时用字符串表示,计算时采用 64位有符号整数进行计算,如果超出表示范围,指令会执行失败,例如:
127.0.0.1:6379> set tmp 1000000000000000000

OK

127.0.0.1:6379> INCRBY tmp 2

(integer) 1000000000000000002

127.0.0.1:6379> INCRBY tmp 2000000000000000000000

(error) ERR value is not an integer or out of range

127.0.0.1:6379> get tmp

"1000000000000000002"

猜你喜欢

转载自cherishlc.iteye.com/blog/2410545
今日推荐