1. Basic Operation:
>>>ImportRedis>>>PrintRedis.__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 ()>>> forKeyinchInfo: ...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:linux3.16.0-37-Generic x86_64keyspace_hits:43>>>
Basic operations for Redis under Python: