python下redis的基本操作:
1. 基本操作:
>>> import redis
>>> print redis.__file__
/usr/local/lib/python2.7/dist-packages/redis/__init__.pyc
>>> redisClient = redis.Redis(host='127.0.0.1', port=6379, db=0)
>>> info = redisClient.info()
>>> for key in info:
... print "%s:%s" %(key, info[key])
...
aof_rewrite_in_progress:0
total_connections_received:8
run_id:0a62a8d1e52971400a930715b8f621e05a26ba8b
rejected_connections:0
redis_build_id:cee0f9a49c3c27aa
used_memory_peak_human:578.38K
pubsub_patterns:0
redis_mode:standalone
connected_slaves:0
db2:{'keys': 179, 'expires': 0, 'avg_ttl': 0}
uptime_in_days:0
multiplexing_api:epoll
lru_clock:9571444
redis_version:2.8.13
redis_git_sha1:0
sync_partial_ok:0
gcc_version:4.9.1
connected_clients:2
keyspace_misses:4
used_memory:590392
tcp_port:6379
master_repl_offset:0
used_cpu_user_children:0.0
repl_backlog_first_byte_offset:0
rdb_current_bgsave_time_sec:-1
pubsub_channels:0
used_cpu_user:1.96
used_memory_lua:33792
instantaneous_ops_per_sec:0
rdb_last_save_time:1435633828
total_commands_processed:141
aof_last_write_status:ok
role:master
aof_rewrite_scheduled:0
sync_partial_err:0
used_memory_rss:7311360
hz:10
sync_full:0
aof_enabled:0
config_file:/etc/redis/redis.conf
used_cpu_sys:3.1
rdb_last_bgsave_status:ok
latest_fork_usec:135
aof_last_bgrewrite_status:ok
db4:{'keys': 7, 'expires': 6, 'avg_ttl': 721067416}
aof_last_rewrite_time_sec:-1
used_memory_human:576.55K
loading:0
blocked_clients:0
process_id:2006
db0:{'keys': 3, 'expires': 0, 'avg_ttl': 0}
repl_backlog_histlen:0
client_biggest_input_buf:0
aof_current_rewrite_time_sec:-1
arch_bits:64
repl_backlog_active:0
mem_fragmentation_ratio:12.38
rdb_last_bgsave_time_sec:0
expired_keys:0
used_cpu_sys_children:0.01
evicted_keys:0
rdb_bgsave_in_progress:0
repl_backlog_size:1048576
client_longest_output_list:0
mem_allocator:jemalloc-3.6.0
used_memory_peak:592256
db3:{'keys': 1, 'expires': 1, 'avg_ttl': 686672452}
uptime_in_seconds:9532
rdb_changes_since_last_save:0
redis_git_dirty:0
os:Linux 3.16.0-37-generic x86_64
keyspace_hits:43
>>>
python下redis的基本操作:的更多相关文章
- python下的orm基本操作(1)--Mysql下的CRUD简单操作(含源码DEMO)
最近逐渐打算将工作的环境转移到ubuntu下,突然发现对于我来说,这ubuntu对于我这种上上网,收收邮件,写写博客,写写程序的时实在是太合适了,除了刚接触的时候会不怎么完全适应命令行及各种权限管理, ...
- Python下redis包安装
找到Python的第三方包安装路径,在dos命令行中切换到该目录,输入: pip install redis 最后在Python解释器中即可.
- Python下操作Memcache/Redis/RabbitMQ说明
一.MemcacheMemcache是一套分布式的高速缓存系统,由LiveJournal的Brad Fitzpatrick开发,但目前被许多网站使用以提升网站的访问速度,尤其对于一些大型的.需要频繁访 ...
- python 对redis key的基本操作
首先看一下Python 操作redis.StrictRedis 的初始化方法__init__ def __init__(self, host='localhost', port=6379, db=0, ...
- Linux 下的python操作redis
python操作redis Redis redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).se ...
- python——操作Redis
在使用django的websocket的时候,发现web请求和其他当前的django进程的内存是不共享的,猜测django的机制可能是每来一个web请求,就开启一个进程去与web进行交互,一次来达到利 ...
- Python使用Redis数据库
Redis 简介 Redis是开源的高性能Key-Value数据库,可以用于缓存等用途. Redis可以提供事务和持久化支持保证并发安全性,并提供TTL(time to life)服务. 使用Redi ...
- Python操作Redis,你要的都在这了!
Redis是一个基于内存的高效的键值型非关系型数据库,存取效率极高,而且支持多种存储数据结构,使用也非常简单.本节中,我们就来介绍一下Python的Redis操作,主要介绍RedisPy这个库的用法. ...
- python使用redis缓存数据库
Redis 关注公众号"轻松学编程"了解更多. Windows下直接解压可用,链接:https://pan.baidu.com/s/1rD4ujoN7h96TtHSu3sN_hA ...
随机推荐
- Top 10 Questions about Java Exceptions--reference
reference from:http://www.programcreek.com/2013/10/top-10-questions-about-java-exceptions/ This arti ...
- 通过NSURLProtocol拦截HTTP转HTTPS来整合SPDY的记录
众所周知,iOS 9.0之后苹果引入ATS限制,苹果也推荐尽量不要使用HTTP通讯了,毕竟是很不安全的.而国内各个有(wu)节操的运营商也会经常篡改请求HTTP请求.所以如果可能,在不影响性能的情况下 ...
- select组件
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...
- 发布GeoServer后预览提示下载wms文件
这是因为发布的图层有中文所导致的,只需修改tomcat的server.xml文件 <Connector port="8080" protocol="HTTP/1.1 ...
- Dom操作--全选反选
我们经常会在网站上遇到一些多选的情况,下面我就来说说使用Dom写全选反选的思路. 全选思路:首先,我们来分析一下知道,当我们点击"全选"复选框的时候,所有的复选框应该都被选中,那我 ...
- java main函数不执行?
今天脑袋短路,对于这个问题纠结了好久.这个问题具体是这样的: public class test { public static void main(String[] args) { test2 t ...
- 升级Capitan 10.11以后CocoaPod 无效解决办法
今天发现升级10.11的系统以后执行 pod install 的时候报错 zsh: command not found: pod 解决方法如下: 1.检查gem 的数据源 gem sources -l ...
- postgres create table default now
key_time timestamp without time zone default timestamp 'now()' see http://wordpress.factj.com/
- 模板:优先队列(priority_queue)
#include <iostream> #include <cstdio> #include <queue> #include <vector> usi ...
- Github进行项目管理的常用命令总结
最近项目中使用github来管理代码,将git的常用命令整理了一下,方便以后查询 查看git的本地配置git config --list 克隆到本地git clone (网页上面的那个http地址 g ...