Created
August 1, 2011 05:18
-
-
Save uu59/1117611 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -- coding: utf-8 | |
require "net/http" | |
# ktserver --version | |
# Kyoto Tycoon 0.9.49 (2.13) on Mac OS X (Kyoto Cabinet 1.2.69) | |
# ktserver -port 19999 '%' | |
Net::HTTP.start('localhost', 19999) do |http| | |
9.times{|n| | |
http.post('/rpc/set', "key=#{n}&value=#{n}") | |
} | |
http.post('/rpc/cur_jump', "key=5&CUR=1") | |
res = http.post('/rpc/cur_get_key', "CUR=1") | |
p res.body.split("\t") # => ["key", "5"] | |
http.post('/rpc/cur_step', "CUR=1") | |
res = http.post('/rpc/cur_get_key', "CUR=1") | |
p res.body.split("\t") # => ["key", "6"] | |
http.post('/rpc/cur_step_back', "CUR=1") | |
res = http.post('/rpc/cur_get_key', "CUR=1") | |
p res.body.split("\t") # => ["key", "5"] | |
## | |
## following result is 4, but is it correct behavior? | |
## | |
http.post('/rpc/cur_step', "CUR=1") | |
res = http.post('/rpc/cur_get_key', "CUR=1") | |
p res.body.split("\t") # => ["key", "4"] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment