python下redis的基本操作:

來源:互聯網
上載者:User

標籤:

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:0total_connections_received:8run_id:0a62a8d1e52971400a930715b8f621e05a26ba8brejected_connections:0redis_build_id:cee0f9a49c3c27aaused_memory_peak_human:578.38Kpubsub_patterns:0redis_mode:standaloneconnected_slaves:0db2:{‘keys‘: 179, ‘expires‘: 0, ‘avg_ttl‘: 0}uptime_in_days:0multiplexing_api:epolllru_clock:9571444redis_version:2.8.13redis_git_sha1:0sync_partial_ok:0gcc_version:4.9.1connected_clients:2keyspace_misses:4used_memory:590392tcp_port:6379master_repl_offset:0used_cpu_user_children:0.0repl_backlog_first_byte_offset:0rdb_current_bgsave_time_sec:-1pubsub_channels:0used_cpu_user:1.96used_memory_lua:33792instantaneous_ops_per_sec:0rdb_last_save_time:1435633828total_commands_processed:141aof_last_write_status:okrole:masteraof_rewrite_scheduled:0sync_partial_err:0used_memory_rss:7311360hz:10sync_full:0aof_enabled:0config_file:/etc/redis/redis.confused_cpu_sys:3.1rdb_last_bgsave_status:oklatest_fork_usec:135aof_last_bgrewrite_status:okdb4:{‘keys‘: 7, ‘expires‘: 6, ‘avg_ttl‘: 721067416}aof_last_rewrite_time_sec:-1used_memory_human:576.55Kloading:0blocked_clients:0process_id:2006db0:{‘keys‘: 3, ‘expires‘: 0, ‘avg_ttl‘: 0}repl_backlog_histlen:0client_biggest_input_buf:0aof_current_rewrite_time_sec:-1arch_bits:64repl_backlog_active:0mem_fragmentation_ratio:12.38rdb_last_bgsave_time_sec:0expired_keys:0used_cpu_sys_children:0.01evicted_keys:0rdb_bgsave_in_progress:0repl_backlog_size:1048576client_longest_output_list:0mem_allocator:jemalloc-3.6.0used_memory_peak:592256db3:{‘keys‘: 1, ‘expires‘: 1, ‘avg_ttl‘: 686672452}uptime_in_seconds:9532rdb_changes_since_last_save:0redis_git_dirty:0os:Linux 3.16.0-37-generic x86_64keyspace_hits:43>>> 

 

python下redis的基本操作:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.