This commit is contained in:
Evan Weaver 2009-08-03 12:12:13 -07:00
Родитель ebe13d29df
Коммит 92a17a25cd
3 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@ -421,14 +421,13 @@ Please note that when pipelining is enabled, setter and deleter methods do not r
def set_servers(servers)
add_method = options[:use_udp] ? "memcached_server_add_udp_with_weight" : "memcached_server_add_with_weight"
Array(servers).each_with_index do |server, index|
debugger
if server.is_a?(String) and File.socket?(server)
Lib.memcached_server_add_unix_socket_with_weight(@struct, server, options[:default_weight].to_i)
elsif server.is_a?(String) and server =~ /^[\w\d\.-]+(:\d{1,5}){0,2}$/
host, port, weight = server.split(":")
Lib.memcached_server_add_with_weight(@struct, host, port.to_i, (weight || options[:default_weight]).to_i)
else
raise ArgumentError, "Servers must be either in the format 'host:port[:weight]' (e.g., 'localhost:11211' or 'localhost:11211:10') for a network server, or a valid pathname (e.g., /var/run/memcached) for a Unix domain socket."
raise ArgumentError, "Servers must be either in the format 'host:port[:weight]' (e.g., 'localhost:11211' or 'localhost:11211:10') for a network server, or a valid path to a Unix domain socket (e.g., /var/run/memcached)."
end
end
# For inspect

Просмотреть файл

@ -7,7 +7,7 @@ require 'benchmark'
class MemcachedTest < Test::Unit::TestCase
def setup
@servers = ['localhost:43042', 'localhost:43043',UNIX_SOCKET_NAME]
@servers = ['localhost:43042', 'localhost:43043', "#{UNIX_SOCKET_NAME}0"]
# Maximum allowed prefix key size for :hash_with_prefix_key_key => false
@prefix_key = 'prefix_key_'

Просмотреть файл

@ -4,7 +4,7 @@ require "#{File.dirname(__FILE__)}/../test_helper"
class RailsTest < Test::Unit::TestCase
def setup
@servers = ['127.0.0.1:43042', '127.0.0.1:43043',UNIX_SOCKET_NAME]
@servers = ['127.0.0.1:43042', '127.0.0.1:43043', "#{UNIX_SOCKET_NAME}0"]
@namespace = 'rails_test'
@cache = Memcached::Rails.new(:servers => @servers, :namespace => @namespace)
@value = OpenStruct.new(:a => 1, :b => 2, :c => GenericClass)