这是Redis官方文档的keys列表

(1) set  key value--设置某个键为某个值

(2) get key -- 获取设置的值

(3)del key -- 删除设置的键

(4)expire  key seconds-- 设置键值的存在时间

(5)expireat key timestamp -- 更高级的键值保存时间。

(6)keys pattern --查看键值的个数  (keys *可以返回所有的键)

(7)move key db  -- 将某个键值移动到另外的数据库(可以用select db来选择数据库)

(8)object --

The OBJECT command allows to inspect the internals of Redis Objects associated with keys. It is useful for debugging or to understand if your keys are using the specially encoded data types to save space. Your application may also use the information reported by the OBJECT command to implement application level key eviction policies when using Redis as a Cache.

The OBJECT command supports multiple sub commands:

  • OBJECT REFCOUNT <key> returns the number of references of the value associated with the specified key. This command is mainly useful for debugging.
  • OBJECT ENCODING <key> returns the kind of internal representation used in order to store the value associated with a key.
  • OBJECT IDLETIME <key> returns the number of seconds since the object stored at the specified key is idle (not requested by read or write operations). While the value is returned in seconds the actual resolution of this timer is 10 seconds, but may vary in future implementations.

Objects can be encoded in different ways:

  • Strings can be encoded as raw (normal string encoding) or int (strings representing integers in a 64 bit signed interval are encoded in this way in order to save space).
  • Lists can be encoded as ziplist or linkedlist. The ziplist is the special representation that is used to save space for small lists.
  • Sets can be encoded as intset or hashtable. The intset is a special encoding used for small sets composed solely of integers.
  • Hashes can be encoded as zipmap or hashtable. The zipmap is a special encoding used for small hashes.
  • Sorted Sets can be encoded as ziplist or skiplist format. As for the List type small sorted sets can be specially encoded using ziplist, while the skiplist encoding is the one that works with sorted sets of any size.

All the specially encoded types are automatically converted to the general type once you perform an operation that makes it impossible for Redis to retain the space saving encoding.

Return value

Different return values are used for different subcommands.

  • Subcommands refcount and idletime return integers.
  • Subcommand encoding returns a bulk reply.

If the object you try to inspect is missing, a null bulk reply is returned.

Examples

redis> lpush mylist "Hello World"
(integer) 4
redis> object refcount mylist
(integer) 1
redis> object encoding mylist
"ziplist"
redis> object idletime mylist
(integer) 10

In the following example you can see how the encoding changes once Redis is no longer able to use the space saving encoding.

redis> set foo 1000
OK
redis> object encoding foo
"int"
redis> append foo bar
(integer) 7
redis> get foo
"1000bar"
redis> object encoding foo
"raw"

(9)pexpire key milliseconds -- 设置毫秒级别的键值保存

(10)pexpireat key milliseconds--timestap

(11)ttl key -- 返回设置的键值保存期限还有多少秒!

(12)rename key newkey -- 重新命名一个新的key值

(13)renamenx key newkey -- 重新命名一个新的key值仅仅在key 不存在的情况下

(14)SORT key [BY pattern] [LIMIT offset count][GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA][STORE destination]

最新文章

  1. Tomcat7.0+的JNDI问题
  2. 宿主机远程桌面连接vmware中的虚拟机
  3. T-SQL编程 —— 用户自定义函数(标量函数)
  4. 一、IOS运行原理
  5. Openmpi 编译安装+集群配置 + Ubuntu14.04 + SSH无密码连接 + NFS共享文件系统
  6. python【第五篇】常用模块学习
  7. UPDATE---修改表中数据
  8. C++中的基类和派生类
  9. dp related problems (update continuously)
  10. Android客户端连接服务器端,向服务器端发送请求HttpURLConnection
  11. Vue-Router路由 Vue-CLI脚手架和模块化开发 之 使用路由对象获取参数
  12. 转:MD5辅助类
  13. 【二】jquery之基础概念与jquery对象与dom对象的区别及混合使用
  14. Mysql最左匹配原则实践(原创)
  15. PAT 甲级 1043 Is It a Binary Search Tree
  16. Spark2.0 Pipelines
  17. Quartz JobStore管理Job
  18. skkyk:题解 洛谷P3865 【【模板】ST表】
  19. exist not exist 分析
  20. PAT 1072. Gas Station

热门文章

  1. php中::的使用方法
  2. android的多渠道打包
  3. log4j2自定义输出线程环境信息
  4. Windows 8.1 应用再出发 - 视图状态的更新
  5. 我的复杂的OpenCV编译之路(OpenCV3.1.0 + VS2010 + Win7)
  6. JBOSS通过Apache负载均衡方法一:使用mod_jk
  7. hibernate连接查询
  8. 设计模式UML类图基础
  9. [Phalcon-framework] Phalcon framework - Dependency Injection/Service Location And the MVC architecture note 1
  10. SQLSERVER复制的要点