Getting Couchbase::Error::Timeout

I am trying to write a small ruby program to connect to couchbase server and create a document. I am able to connect to couchbase server but when I try to do a get/set/touch I get a timeout error - (Couchbase::Error::Timeout)
sample:

require 'rubygems’
require 'couchbase’
c = Couchbase.connect(:hostname=>‘localhost’,:port=>8091,:username => ‘Administrator’, :password=>‘password’, :bucket=>‘test’)
puts c.name
c.touch(“foo”)
c.disconnect

output:
test
load_couchbase.rb:10:in touch': failed to touch value (key="foo", error=0x17) (Couchbase::Error::Timeout) from load_couchbase.rb:10:in'
Any clue to get past this error?
thanks.

I see a few problems here, one the :username => should be the bucket name. Second, if you didn’t set a SASL password for the test bucket, then password is not required, otherwise it should match. You can check the connection with c.connected? method. Couchbase::Error::Timeout typically indicates either that you are not connected or that for some network connectivity issue it reached the timeout. Also you don’t seem to be setting the data first.
puts c.connected?
c.set(“foo”, “value”, :ttl => 30) # => set key-value and 30 second expiration
c.touch(“foo”) # => touch the key with default expiration (which is 0, meaning no expiration, unless you change it in the connect method or explicitly)
c.touch(“foo”, :ttl => 60) # => change to 60 second expiration
Also you don’t need to call c.disconnect explicitly, that is handled implicitly already.
Reply to this thread if you need anything else…