nicolasff / webdis

A Redis HTTP interface with JSON output
https://webd.is
BSD 2-Clause "Simplified" License
2.83k stars 304 forks source link

INFO command responce #5

Closed aleksraiden closed 13 years ago

aleksraiden commented 13 years ago

If we get INFO command response, we have JSON, but in the data we have all lines from Redis output, joined with \r\n. Mybe correctly output for this command generated full json structure with one key per each info params? With this we have direct use response in JS or other web application without decoding and preprocessing.

nicolasff commented 13 years ago

Good idea. Have you seen the new format though? I'm not sure how that would be structured. On http://antirez.com/post/new-info-diskstore-cluster-eta.html :

# Server
redis_version:2.3.0
redis_git_sha1:9b45592c
redis_git_dirty:1
arch_bits:64
multiplexing_api:kqueue
process_id:17790
tcp_port:6379
uptime_in_seconds:1012
uptime_in_days:0
lru_clock:1661879

# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
...
aleksraiden commented 13 years ago

"INFO": {

"Server" : { "redis_version":"2.3.0", "redis_git_sha1":"9b45592c", "redis_git_dirty":1, "arch_bits":64},

"Clients": {}, "Memory": {} }

Sorry for poor formatting... Yes, new info format in Redis is very good

nicolasff commented 13 years ago

What you wrote is perfectly good, but it won't work with all versions. I'll see if I can provide both, an object for the old response type and a nested one for the new type.

nicolasff commented 13 years ago

I have pushed a patch to handle the first case. I'll add support for the new format in the next few days.

aleksraiden commented 13 years ago

Thanks, today try to test it.