redis keys 命令

## 删除存在的key
del key

## 序列体弱给定key,并返回被序列化的值
dump key

## 检查key是否存在
exists key 

## 为给定key设置过期时间
expire key seconds

## EXPIREAT 的作用和 EXPIRE 类似,都用于为 key 设置过期时间。 不同在于 EXPIREAT 命令接受的时间参数是 UNIX 时间戳(unix timestamp)。
EXPIREAT key timestamp

##设置 key 的过期时间以毫秒计
PEXPIRE key milliseconds

##设置 key 过期时间的时间戳(unix timestamp) 以毫秒计
pexpireat key milliseconds

## 查找所有符合给定模式( pattern)的 key 。
keys pattern

##将当前数据库的 key 移动到给定的数据库 db 当中。
move key db

## 移除 key 的过期时间,key 将持久保持
persist key

##以秒为单位,返回给定 key 的剩余生存时间(TTL, time to live)。
TTL key

##以毫秒为单位返回 key 的剩余的过期时间
pttl key

##从当前数据库中随机返回一个 key
randomkey

##修改 key 的名称
RENAME key newkey

##仅当 newkey 不存在时,将 key 改名为 newkey 。
RENAMENX key newkey

## 返回key所储存的值的类型
type key

猜你喜欢

转载自www.cnblogs.com/konglingxi/p/9452371.html