本篇文章主要介绍了"Redis运维之常用命令操作",主要涉及到redis方面的内容,对于其他数据库感兴趣的同学可以参考一下:
在平时的工作中,需要根据需求对Redis数据库进行一些操作。可以参考Redis官网http://redis.io/commands 进行详细了解 1.SELEC...
redis 127.0.0.1:6379> help expireat
EXPIREAT key timestamp
summary: Set the expiration for a key as a UNIX timestamp
since: 1.2.0
group: generic
redis 127.0.0.1:6379> expireat foo 1431532800
(integer) 1
redis 127.0.0.1:6379> ttl foo
(integer) 3210141
21.GET
获取一个KEY的值
redis 127.0.0.1:6379> help get
GET key
summary: Get the value of a key
since: 1.0.0
group: string
redis 127.0.0.1:6379> get foo
"test"
22.HGET
获取一个哈希字段的值
redis 127.0.0.1:6379> help hget
HGET key field
summary: Get the value of a hash field
since: 2.0.0
group: hash
redis 127.0.0.1:6379> hset myhash field1 "foo"
(integer) 1
redis 127.0.0.1:6379> hget myhash field1
"foo"
redis 127.0.0.1:6379> hget myhash field2
(nil)
redis 127.0.0.1:6379>
23.LASTSAVE
上次成功保存数据到磁盘的UNIX时间戳
redis 127.0.0.1:6379> help lastsave
LASTSAVE -
summary: Get the UNIX time stamp of the last successful save to disk
since: 1.0.0
group: server
redis 127.0.0.1:6379> lastsave
(integer) 1428373205
redis 127.0.0.1:6379>
24.LPUSH
将一个或多个值附加到一个Redis列表中