зеркало из https://github.com/github/memcached.git
Better inspect.
This commit is contained in:
Родитель
783aaafcb6
Коммит
5dd8e2b98c
12
README
12
README
|
@ -22,14 +22,14 @@ The <b>memcached</b> 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:
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче