diff --git a/README b/README index 065f40b..fda75af 100644 --- a/README +++ b/README @@ -22,14 +22,14 @@ The memcached library wraps the pure-C libmemcached client via SWIG. == Installation -You need Ruby 1.8.6, and {libmemcached 0.25}[http://tangent.org/552/libmemcached.html]. Other versions are not guaranteed to work. You also need {memcached itself}[http://www.danga.com/memcached/] if you want to test against a local server. +You need Ruby 1.8.6, and {libmemcached 0.32}[http://tangent.org/552/libmemcached.html]. Other versions are not guaranteed to work. You also need {memcached itself}[http://www.danga.com/memcached/] if you want to test against a local server. -For Linux, download and extract the {libmemcached tarball}[http://download.tangent.org/libmemcached-0.25.tar.gz]. Then run: +For Linux, download and extract the {libmemcached tarball}[http://download.tangent.org/libmemcached-0.32.tar.gz]. Then run: ./configure make && sudo make install For OS X, you may be able to install it from MacPorts: - sudo port install libmemcached @0.25 + sudo port install libmemcached @0.32 Now install the gem: sudo gem install memcached --no-rdoc --no-ri @@ -41,15 +41,11 @@ Note that on OS X 10.5 you may need to set the architecture explicitly: Start a local networked memcached server: $ memcached -p 11211 & -Or a local unix domain socket memcached server: - $ memcached -s memcached_socket & - Now, in Ruby, require the library and instantiate a Memcached object at a global level: require 'memcached' - $cache = Memcached.new("localhost:11211") # for network socket - $cache = Memcached.new("memcached_socket") # for unix domain socket + $cache = Memcached.new("localhost:11211") Now you can set things and get things: diff --git a/lib/memcached/memcached.rb b/lib/memcached/memcached.rb index c0dd0ae..e4ab782 100644 --- a/lib/memcached/memcached.rb +++ b/lib/memcached/memcached.rb @@ -459,7 +459,11 @@ Please note that when pipelining is enabled, setter and deleter methods do not r # Stringify an opaque server struct def inspect_server(server) - # zero port means unix domain socket memcached - "#{server.hostname}#{":#{server.port}" unless is_unix_socket?(server)}#{":#{server.weight}" if !is_unix_socket?(server) and options[:ketama_weighted]}" + strings = [server.hostname] + if !is_unix_socket?(server) + strings << ":#{server.port}" + strings << ":#{server.weight}" if options[:ketama_weighted] + end + strings.join end end diff --git a/test/test_helper.rb b/test/test_helper.rb index ab0fbf8..523b803 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -12,7 +12,7 @@ require 'memcached' require 'test/unit' require 'ostruct' -UNIX_SOCKET_NAME = File.join(ENV['TMPDIR']||'/tmp','memcached') +UNIX_SOCKET_NAME = File.join(ENV['TMPDIR']||'/tmp','memcached') unless defined? UNIX_SOCKET_NAME class GenericClass end