memcached 0.15.1 → 0.15.2

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/BENCHMARKS CHANGED
@@ -7,90 +7,90 @@ You can easily run your own benchmarks, as long as you have memcached itself on
7
7
 
8
8
  == x86-64 OS X
9
9
 
10
- These benchmarks were run on 64-bit Intel OS X 10.5 (25,000 iterations):
10
+ These benchmarks were run on an OS X 10.5 Core 2 Duo machine (25,000 iterations):
11
11
 
12
- user system total real
13
- set:plain:noblock:memcached:net 0.650000 0.250000 0.900000 ( 2.165262)
14
- set:plain:noblock:memcached:uds 0.580000 0.140000 0.720000 ( 1.023195)
15
- set:plain:memcached:net 1.540000 2.440000 3.980000 ( 9.317136)
16
- set:plain:memcached:uds 1.230000 1.400000 2.630000 ( 4.919294)
17
- set:plain:memcache-client 21.030000 8.650000 29.680000 ( 31.999873)
18
- set:ruby:noblock:memcached:net 1.160000 0.250000 1.410000 ( 2.685066)
19
- set:ruby:noblock:memcached:uds 1.080000 0.160000 1.240000 ( 1.496034)
20
- set:ruby:memcached:net 2.250000 2.660000 4.910000 ( 10.650423)
21
- set:ruby:memcached:uds 1.930000 1.590000 3.520000 ( 6.051250)
22
- set:ruby:memcache-client 22.000000 8.780000 30.780000 ( 32.554235)
23
- get:plain:memcached:net 1.860000 2.720000 4.580000 ( 9.813708)
24
- get:plain:memcached:uds 1.540000 1.540000 3.080000 ( 5.065145)
25
- get:plain:memcache-client 25.040000 8.780000 33.820000 ( 35.932318)
26
- get:ruby:memcached:net 2.380000 2.780000 5.160000 ( 10.395301)
27
- get:ruby:memcached:uds 1.960000 1.590000 3.550000 ( 5.531036)
28
- get:ruby:memcache-client 25.490000 8.790000 34.280000 ( 36.092947)
29
- multiget:ruby:memcached:net 1.300000 0.970000 2.270000 ( 3.424010)
30
- multiget:ruby:memcached:uds 1.280000 0.720000 2.000000 ( 2.375904)
31
- multiget:ruby:memcache-client 13.380000 3.170000 16.550000 ( 17.743902)
32
- missing:ruby:memcached:net 2.450000 2.600000 5.050000 ( 9.982122)
33
- missing:ruby:memcached:uds 2.080000 1.600000 3.680000 ( 5.168750)
34
- missing:ruby:memcached:inline 2.370000 2.480000 4.850000 ( 10.374502)
35
- missing:ruby:memcached_UDS:inline 2.020000 1.600000 3.620000 ( 5.315222)
36
- missing:ruby:memcache-client 21.200000 8.220000 29.420000 ( 30.533481)
37
- mixed:ruby:noblock:memcached:net 4.590000 6.050000 10.640000 ( 20.344957)
38
- mixed:ruby:noblock:memcached:uds 3.650000 2.650000 6.300000 ( 10.304713)
39
- mixed:ruby:memcached:net 4.580000 4.920000 9.500000 ( 19.785283)
40
- mixed:ruby:memcached:uds 3.850000 2.920000 6.770000 ( 10.850842)
41
- mixed:ruby:memcache-client 47.790000 16.510000 64.300000 ( 67.698660)
42
- hash:hsieh 0.050000 0.000000 0.050000 ( 0.051601)
43
- hash:fnv1_32 0.090000 0.000000 0.090000 ( 0.091872)
44
- hash:fnv1a_32 0.140000 0.000000 0.140000 ( 0.137040)
45
- hash:fnv1_64 0.240000 0.000000 0.240000 ( 0.246802)
46
- hash:fnv1a_64 0.130000 0.000000 0.130000 ( 0.133671)
47
- hash:murmur 0.090000 0.000000 0.090000 ( 0.095826)
48
- hash:default 0.120000 0.000000 0.120000 ( 0.124794)
49
- hash:jenkins 0.100000 0.010000 0.110000 ( 0.111693)
50
- hash:md5 0.230000 0.000000 0.230000 ( 0.229894)
51
- hash:crc 0.090000 0.000000 0.090000 ( 0.093286)
12
+ user system total real
13
+ set:plain:noblock:memcached:net 0.650000 0.250000 0.900000 ( 2.165262)
14
+ set:plain:noblock:memcached:uds 0.580000 0.140000 0.720000 ( 1.023195)
15
+ set:plain:memcached:net 1.540000 2.440000 3.980000 ( 9.317136)
16
+ set:plain:memcached:uds 1.230000 1.400000 2.630000 ( 4.919294)
17
+ set:plain:memcache-client 21.030000 8.650000 29.680000 ( 31.999873)
18
+ set:ruby:noblock:memcached:net 1.160000 0.250000 1.410000 ( 2.685066)
19
+ set:ruby:noblock:memcached:uds 1.080000 0.160000 1.240000 ( 1.496034)
20
+ set:ruby:memcached:net 2.250000 2.660000 4.910000 ( 10.650423)
21
+ set:ruby:memcached:uds 1.930000 1.590000 3.520000 ( 6.051250)
22
+ set:ruby:memcache-client 22.000000 8.780000 30.780000 ( 32.554235)
23
+ get:plain:memcached:net 1.860000 2.720000 4.580000 ( 9.813708)
24
+ get:plain:memcached:uds 1.540000 1.540000 3.080000 ( 5.065145)
25
+ get:plain:memcache-client 25.040000 8.780000 33.820000 ( 35.932318)
26
+ get:ruby:memcached:net 2.380000 2.780000 5.160000 ( 10.395301)
27
+ get:ruby:memcached:uds 1.960000 1.590000 3.550000 ( 5.531036)
28
+ get:ruby:memcache-client 25.490000 8.790000 34.280000 ( 36.092947)
29
+ multiget:ruby:memcached:net 1.300000 0.970000 2.270000 ( 3.424010)
30
+ multiget:ruby:memcached:uds 1.280000 0.720000 2.000000 ( 2.375904)
31
+ multiget:ruby:memcache-client 13.380000 3.170000 16.550000 ( 17.743902)
32
+ missing:ruby:memcached:net 2.450000 2.600000 5.050000 ( 9.982122)
33
+ missing:ruby:memcached:uds 2.080000 1.600000 3.680000 ( 5.168750)
34
+ missing:ruby:memcached:inline 2.370000 2.480000 4.850000 ( 10.374502)
35
+ missing:ruby:memcached:uds:inline 2.020000 1.600000 3.620000 ( 5.315222)
36
+ missing:ruby:memcache-client 21.200000 8.220000 29.420000 ( 30.533481)
37
+ mixed:ruby:noblock:memcached:net 4.590000 6.050000 10.640000 ( 20.344957)
38
+ mixed:ruby:noblock:memcached:uds 3.650000 2.650000 6.300000 ( 10.304713)
39
+ mixed:ruby:memcached:net 4.580000 4.920000 9.500000 ( 19.785283)
40
+ mixed:ruby:memcached:uds 3.850000 2.920000 6.770000 ( 10.850842)
41
+ mixed:ruby:memcache-client 47.790000 16.510000 64.300000 ( 67.698660)
42
+ hash:hsieh 0.050000 0.000000 0.050000 ( 0.051601)
43
+ hash:fnv1_32 0.090000 0.000000 0.090000 ( 0.091872)
44
+ hash:fnv1a_32 0.140000 0.000000 0.140000 ( 0.137040)
45
+ hash:fnv1_64 0.240000 0.000000 0.240000 ( 0.246802)
46
+ hash:fnv1a_64 0.130000 0.000000 0.130000 ( 0.133671)
47
+ hash:murmur 0.090000 0.000000 0.090000 ( 0.095826)
48
+ hash:default 0.120000 0.000000 0.120000 ( 0.124794)
49
+ hash:jenkins 0.100000 0.010000 0.110000 ( 0.111693)
50
+ hash:md5 0.230000 0.000000 0.230000 ( 0.229894)
51
+ hash:crc 0.090000 0.000000 0.090000 ( 0.093286)
52
52
 
53
53
  == x86-64 Linux
54
54
 
55
- These benchmarks were run on Xeon RHEL4 (25,000 iterations):
55
+ These benchmarks were run on a RHEL4 Xeon machine (25,000 iterations):
56
56
 
57
- user system total real
58
- set:plain:noblock:memcached:net 0.560000 0.370000 0.930000 ( 1.492691)
59
- set:plain:noblock:memcached:uds 0.500000 0.120000 0.620000 ( 0.837311)
60
- set:plain:memcached:net 1.070000 1.350000 2.420000 ( 4.655494)
61
- set:plain:memcached:uds 1.030000 0.590000 1.620000 ( 3.126471)
62
- set:plain:memcache-client 19.270000 1.500000 20.770000 ( 24.860087)
63
- set:ruby:noblock:memcached:net 1.090000 0.120000 1.210000 ( 2.583293)
64
- set:ruby:noblock:memcached:uds 1.100000 0.120000 1.220000 ( 1.501633)
65
- set:ruby:memcached:net 1.760000 1.410000 3.170000 ( 5.481738)
66
- set:ruby:memcached:uds 1.750000 0.590000 2.340000 ( 4.040445)
67
- set:ruby:memcache-client 19.490000 1.430000 20.920000 ( 24.545314)
68
- get:plain:memcached:net 1.160000 1.200000 2.360000 ( 4.515177)
69
- get:plain:memcached:uds 1.110000 0.630000 1.740000 ( 3.039308)
70
- get:plain:memcache-client 22.100000 1.440000 23.540000 ( 26.822877)
71
- get:ruby:memcached:net 1.770000 1.110000 2.880000 ( 5.029304)
72
- get:ruby:memcached:uds 1.680000 0.600000 2.280000 ( 3.241249)
73
- get:ruby:memcache-client 22.770000 1.430000 24.200000 ( 28.643709)
74
- multiget:ruby:memcached:net 1.030000 0.420000 1.450000 ( 2.132928)
75
- multiget:ruby:memcached:uds 1.080000 0.250000 1.330000 ( 1.914999)
76
- multiget:ruby:memcache-client 13.410000 0.520000 13.930000 ( 15.359580)
77
- missing:ruby:memcached:net 1.760000 1.290000 3.050000 ( 5.029804)
78
- missing:ruby:memcached:uds 1.730000 0.620000 2.350000 ( 3.772379)
79
- missing:ruby:memcached:inline 1.750000 1.220000 2.970000 ( 5.029707)
80
- missing:ruby:memcached_UDS:inline 1.620000 0.670000 2.290000 ( 3.612413)
81
- missing:ruby:memcache-client 19.310000 1.360000 20.670000 ( 24.277446)
82
- mixed:ruby:noblock:memcached:net 3.530000 2.310000 5.840000 ( 10.037807)
83
- mixed:ruby:noblock:memcached:uds 3.270000 1.000000 4.270000 ( 6.980218)
84
- mixed:ruby:memcached:net 3.760000 2.510000 6.270000 ( 10.478885)
85
- mixed:ruby:memcached:uds 3.740000 1.190000 4.930000 ( 7.898747)
86
- mixed:ruby:memcache-client 45.900000 2.870000 48.770000 ( 56.733674)
87
- hash:hsieh 0.040000 0.000000 0.040000 ( 0.041816)
88
- hash:md5 0.120000 0.000000 0.120000 ( 0.121045)
89
- hash:fnv1_32 0.060000 0.000000 0.060000 ( 0.062099)
90
- hash:fnv1a_32 0.060000 0.000000 0.060000 ( 0.063173)
91
- hash:fnv1a_64 0.070000 0.000000 0.070000 ( 0.071170)
92
- hash:default 0.080000 0.000000 0.080000 ( 0.081224)
93
- hash:jenkins 0.050000 0.000000 0.050000 ( 0.053789)
94
- hash:fnv1_64 0.090000 0.000000 0.090000 ( 0.089719)
95
- hash:crc 0.080000 0.000000 0.080000 ( 0.079723)
96
- hash:murmur 0.050000 0.000000 0.050000 ( 0.048248)
57
+ user system total real
58
+ set:plain:noblock:memcached:net 0.560000 0.370000 0.930000 ( 1.492691)
59
+ set:plain:noblock:memcached:uds 0.500000 0.120000 0.620000 ( 0.837311)
60
+ set:plain:memcached:net 1.070000 1.350000 2.420000 ( 4.655494)
61
+ set:plain:memcached:uds 1.030000 0.590000 1.620000 ( 3.126471)
62
+ set:plain:memcache-client 19.270000 1.500000 20.770000 ( 24.860087)
63
+ set:ruby:noblock:memcached:net 1.090000 0.120000 1.210000 ( 2.583293)
64
+ set:ruby:noblock:memcached:uds 1.100000 0.120000 1.220000 ( 1.501633)
65
+ set:ruby:memcached:net 1.760000 1.410000 3.170000 ( 5.481738)
66
+ set:ruby:memcached:uds 1.750000 0.590000 2.340000 ( 4.040445)
67
+ set:ruby:memcache-client 19.490000 1.430000 20.920000 ( 24.545314)
68
+ get:plain:memcached:net 1.160000 1.200000 2.360000 ( 4.515177)
69
+ get:plain:memcached:uds 1.110000 0.630000 1.740000 ( 3.039308)
70
+ get:plain:memcache-client 22.100000 1.440000 23.540000 ( 26.822877)
71
+ get:ruby:memcached:net 1.770000 1.110000 2.880000 ( 5.029304)
72
+ get:ruby:memcached:uds 1.680000 0.600000 2.280000 ( 3.241249)
73
+ get:ruby:memcache-client 22.770000 1.430000 24.200000 ( 28.643709)
74
+ multiget:ruby:memcached:net 1.030000 0.420000 1.450000 ( 2.132928)
75
+ multiget:ruby:memcached:uds 1.080000 0.250000 1.330000 ( 1.914999)
76
+ multiget:ruby:memcache-client 13.410000 0.520000 13.930000 ( 15.359580)
77
+ missing:ruby:memcached:net 1.760000 1.290000 3.050000 ( 5.029804)
78
+ missing:ruby:memcached:uds 1.730000 0.620000 2.350000 ( 3.772379)
79
+ missing:ruby:memcached:inline 1.750000 1.220000 2.970000 ( 5.029707)
80
+ missing:ruby:memcached:uds:inline 1.620000 0.670000 2.290000 ( 3.612413)
81
+ missing:ruby:memcache-client 19.310000 1.360000 20.670000 ( 24.277446)
82
+ mixed:ruby:noblock:memcached:net 3.530000 2.310000 5.840000 ( 10.037807)
83
+ mixed:ruby:noblock:memcached:uds 3.270000 1.000000 4.270000 ( 6.980218)
84
+ mixed:ruby:memcached:net 3.760000 2.510000 6.270000 ( 10.478885)
85
+ mixed:ruby:memcached:uds 3.740000 1.190000 4.930000 ( 7.898747)
86
+ mixed:ruby:memcache-client 45.900000 2.870000 48.770000 ( 56.733674)
87
+ hash:hsieh 0.040000 0.000000 0.040000 ( 0.041816)
88
+ hash:md5 0.120000 0.000000 0.120000 ( 0.121045)
89
+ hash:fnv1_32 0.060000 0.000000 0.060000 ( 0.062099)
90
+ hash:fnv1a_32 0.060000 0.000000 0.060000 ( 0.063173)
91
+ hash:fnv1a_64 0.070000 0.000000 0.070000 ( 0.071170)
92
+ hash:default 0.080000 0.000000 0.080000 ( 0.081224)
93
+ hash:jenkins 0.050000 0.000000 0.050000 ( 0.053789)
94
+ hash:fnv1_64 0.090000 0.000000 0.090000 ( 0.089719)
95
+ hash:crc 0.080000 0.000000 0.080000 ( 0.079723)
96
+ hash:murmur 0.050000 0.000000 0.050000 ( 0.048248)
data/CHANGELOG CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ v0.15.2. Don't require memcached itself to build. Fix for AUTO_EJECT_HOSTS in random and modulus pools. Support binary protocol.
3
+
2
4
  v0.15.1. Fix build problem.
3
5
 
4
6
  v0.15. Update to libmemcached 0.31.1. UDP support. Domain socket support (hellvinz). Bugfixes. Bundle libmemcached itself with the gem (antifuchs).
data/README CHANGED
@@ -99,7 +99,7 @@ There is a compatibility wrapper for legacy applications called Memcached::Rails
99
99
 
100
100
  == Benchmarks
101
101
 
102
- <b>memcached</b> is up to 150x faster than <b>memcache-client</b>, and up to 15x faster than <b>caffeine</b>. See BENCHMARKS[link:files/BENCHMARKS.html] for details.
102
+ <b>memcached</b> is up to 10x faster than <b>memcache-client</b>. See BENCHMARKS[link:files/BENCHMARKS.html] for details.
103
103
 
104
104
  == Reporting problems
105
105
 
data/ext/extconf.rb CHANGED
@@ -27,7 +27,7 @@ if !ENV["EXTERNAL_LIB"]
27
27
  raise "'#{cmd}' failed" unless system(cmd)
28
28
 
29
29
  Dir.chdir(BUNDLE_PATH) do
30
- puts(cmd = "env CFLAGS=-fPIC LDFLAGS=-fPIC ./configure --prefix=#{HERE} --disable-shared --disable-utils 2>&1")
30
+ puts(cmd = "env CFLAGS=-fPIC LDFLAGS=-fPIC ./configure --prefix=#{HERE} --without-memcached --disable-shared --disable-utils 2>&1")
31
31
  raise "'#{cmd}' failed" unless system(cmd)
32
32
  puts(cmd = "make || true 2>&1")
33
33
  raise "'#{cmd}' failed" unless system(cmd)
@@ -40,8 +40,8 @@ if !ENV["EXTERNAL_LIB"]
40
40
 
41
41
  # Absolutely prevent the linker from picking up any other libmemcached
42
42
  Dir.chdir("#{HERE}/lib") do
43
- system("cp libmemcached.a libmemcached_gem.a")
44
- system("cp libmemcached.la libmemcached_gem.la")
43
+ system("cp -f libmemcached.a libmemcached_gem.a")
44
+ system("cp -f libmemcached.la libmemcached_gem.la")
45
45
  end
46
46
  $LIBS << " -lmemcached_gem"
47
47
  end
Binary file
@@ -21,9 +21,11 @@ Subclasses correspond one-to-one with server response strings or libmemcached er
21
21
  * Memcached::ConnectionFailure
22
22
  * Memcached::ConnectionSocketCreateFailure
23
23
  * Memcached::CouldNotOpenUnixSocket
24
+ * Memcached::EncounteredAnUnknownStatKey
24
25
  * Memcached::Failure
25
26
  * Memcached::FetchWasNotCompleted
26
27
  * Memcached::HostnameLookupFailure
28
+ * Memcached::ItemValue
27
29
  * Memcached::MemoryAllocationFailure
28
30
  * Memcached::NoServersDefined
29
31
  * Memcached::NotFound
@@ -39,6 +41,7 @@ Subclasses correspond one-to-one with server response strings or libmemcached er
39
41
  * Memcached::SomeErrorsWereReported
40
42
  * Memcached::StatValue
41
43
  * Memcached::SystemError
44
+ * Memcached::TheHostTransportProtocolDoesNotMatchThatOfTheClient
42
45
  * Memcached::UnknownReadFailure
43
46
  * Memcached::WriteFailure
44
47
 
@@ -29,7 +29,8 @@ class Memcached
29
29
  :auto_eject_hosts => true,
30
30
  :server_failure_limit => 2,
31
31
  :verify_key => true,
32
- :use_udp => false
32
+ :use_udp => false,
33
+ :binary_protocol => false
33
34
  }
34
35
 
35
36
  #:stopdoc:
@@ -69,6 +70,7 @@ Valid option parameters are:
69
70
  <tt>:default_weight</tt>:: The weight to use if <tt>:ketama_weighted</tt> is <tt>true</tt>, but no weight is specified for a server.
70
71
  <tt>:hash_with_prefix_key</tt>:: Whether to include the prefix when calculating which server a key falls on. Defaults to <tt>true</tt>.
71
72
  <tt>:use_udp</tt>:: Use the UDP protocol to reduce connection overhead. Defaults to false.
73
+ <tt>:binary_protocol</tt>:: Use the binary protocol to reduce query processing overhead. Defaults to false.
72
74
  <tt>:sort_hosts</tt>:: Whether to force the server list to stay sorted. This defeats consistent hashing and is rarely useful.
73
75
  <tt>:verify_key</tt>:: Validate keys before accepting them. Never disable this.
74
76
 
@@ -314,21 +316,19 @@ Please note that when pipelining is enabled, setter and deleter methods do not r
314
316
  check_return_code(ret, keys)
315
317
 
316
318
  hash = {}
317
- keys.size.times do
319
+ keys.each do
318
320
  value, key, flags, ret = Lib.memcached_fetch_rvalue(@struct)
319
321
  break if ret == Lib::MEMCACHED_END
320
322
  check_return_code(ret, key)
321
- value = Marshal.load(value) if marshal
322
323
  # Assign the value
323
- hash[key] = value
324
+ hash[key] = (marshal ? Marshal.load(value) : value)
324
325
  end
325
326
  hash
326
327
  else
327
328
  # Single get
328
329
  value, flags, ret = Lib.memcached_get_rvalue(@struct, keys)
329
330
  check_return_code(ret, keys)
330
- value = Marshal.load(value) if marshal
331
- value
331
+ marshal ? Marshal.load(value) : value
332
332
  end
333
333
  end
334
334
 
data/memcached.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{memcached}
5
- s.version = "0.15.1"
5
+ s.version = "0.15.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Evan Weaver"]
@@ -13,19 +13,18 @@ Gem::Specification.new do |s|
13
13
  s.extensions = ["ext/extconf.rb"]
14
14
  s.extra_rdoc_files = ["BENCHMARKS", "CHANGELOG", "COMPATIBILITY", "lib/memcached/behaviors.rb", "lib/memcached/exceptions.rb", "lib/memcached/memcached.rb", "lib/memcached/rails.rb", "lib/memcached.rb", "LICENSE", "README", "TODO"]
15
15
  s.files = ["BENCHMARKS", "CHANGELOG", "COMPATIBILITY", "ext/extconf.rb", "ext/libmemcached-0.31.tar.gz", "ext/rlibmemcached.i", "ext/rlibmemcached_wrap.c", "lib/memcached/behaviors.rb", "lib/memcached/exceptions.rb", "lib/memcached/integer.rb", "lib/memcached/memcached.rb", "lib/memcached/rails.rb", "lib/memcached.rb", "LICENSE", "Manifest", "memcached.gemspec", "Rakefile", "README", "test/profile/benchmark.rb", "test/profile/profile.rb", "test/profile/valgrind.rb", "test/setup.rb", "test/teardown.rb", "test/test_helper.rb", "test/unit/binding_test.rb", "test/unit/memcached_test.rb", "test/unit/rails_test.rb", "TODO"]
16
- s.has_rdoc = true
17
16
  s.homepage = %q{http://blog.evanweaver.com/files/doc/fauna/memcached/}
18
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Memcached", "--main", "README"]
19
18
  s.require_paths = ["lib", "ext"]
20
19
  s.rubyforge_project = %q{fauna}
21
- s.rubygems_version = %q{1.3.1}
20
+ s.rubygems_version = %q{1.3.4}
22
21
  s.signing_key = %q{/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-private_key.pem}
23
22
  s.summary = %q{An interface to the libmemcached C client.}
24
23
  s.test_files = ["test/test_helper.rb", "test/unit/binding_test.rb", "test/unit/memcached_test.rb", "test/unit/rails_test.rb"]
25
24
 
26
25
  if s.respond_to? :specification_version then
27
26
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
28
- s.specification_version = 2
27
+ s.specification_version = 3
29
28
 
30
29
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
31
30
  else
@@ -410,7 +410,7 @@ class Bench
410
410
  end
411
411
  end
412
412
  @m = Memcached.new(*@opt_unix)
413
- x.report("missing:ruby:memcached_UDS:inline") do
413
+ x.report("missing:ruby:memcached:uds:inline") do
414
414
  n.times do
415
415
  @m.delete @key1 rescue nil
416
416
  @m.get @key1 rescue nil
@@ -260,6 +260,8 @@ class MemcachedTest < Test::Unit::TestCase
260
260
  result = cache.get key
261
261
  end
262
262
  end).real
263
+
264
+ socket.close
263
265
  end
264
266
 
265
267
  def test_get_with_no_block_server_timeout
@@ -287,6 +289,8 @@ class MemcachedTest < Test::Unit::TestCase
287
289
  result = cache.get key
288
290
  end
289
291
  end).real
292
+
293
+ socket.close
290
294
  end
291
295
 
292
296
  def test_get_with_prefix_key
@@ -789,6 +793,7 @@ class MemcachedTest < Test::Unit::TestCase
789
793
 
790
794
  def test_unresponsive_server
791
795
  socket = stub_server 43041
796
+
792
797
  cache = Memcached.new(
793
798
  [@servers.last, 'localhost:43041'],
794
799
  :prefix_key => @prefix_key,
@@ -826,6 +831,8 @@ class MemcachedTest < Test::Unit::TestCase
826
831
  assert_raise(Memcached::ATimeoutOccurred) do
827
832
  cache.set(key2, @value)
828
833
  end
834
+
835
+ socket.close
829
836
  end
830
837
 
831
838
  def test_missing_server
@@ -868,10 +875,34 @@ class MemcachedTest < Test::Unit::TestCase
868
875
  end
869
876
  end
870
877
 
871
- def test_missing_server_with_random_distribution
872
- cache = Memcached.new(@servers, :distribution => :random)
873
- # FIXME Needs to exercise the ejection code
874
- end
878
+ def test_unresponsive_with_random_distribution
879
+ socket = stub_server 43041
880
+ failures = [Memcached::ATimeoutOccurred, Memcached::ServerIsMarkedDead]
881
+
882
+ cache = Memcached.new(
883
+ [@servers.last, 'localhost:43041'],
884
+ :auto_eject_hosts => true,
885
+ :distribution => :random,
886
+ :server_failure_limit => 1,
887
+ :retry_timeout => 1
888
+ )
889
+
890
+ # Provoke the errors in 'failures'
891
+ exceptions = []
892
+ 100.times { begin; cache.set key, @value; rescue => e; exceptions << e; end }
893
+ assert_equal failures, exceptions.map { |x| x.class }
894
+
895
+ # Hit first server on retry
896
+ assert_nothing_raised { cache.set(key, @value) }
897
+
898
+ # Hit second server again after restore, expect same failures
899
+ sleep(2)
900
+ exceptions = []
901
+ 100.times { begin; cache.set key, @value; rescue => e; exceptions << e; end }
902
+ assert_equal failures, exceptions.map { |x| x.class }
903
+
904
+ socket.close
905
+ end
875
906
 
876
907
  def test_consistent_hashing
877
908
  keys = %w(EN6qtgMW n6Oz2W4I ss4A8Brr QShqFLZt Y3hgP9bs CokDD4OD Nd3iTSE1 24vBV4AU H9XBUQs5 E5j8vUq1 AzSh8fva PYBlK2Pi Ke3TgZ4I AyAIYanO oxj8Xhyd eBFnE6Bt yZyTikWQ pwGoU7Pw 2UNDkKRN qMJzkgo2 keFXbQXq pBl2QnIg ApRl3mWY wmalTJW1 TLueug8M wPQL4Qfg uACwus23 nmOk9R6w lwgZJrzJ v1UJtKdG RK629Cra U2UXFRqr d9OQLNl8 KAm1K3m5 Z13gKZ1v tNVai1nT LhpVXuVx pRib1Itj I1oLUob7 Z1nUsd5Q ZOwHehUa aXpFX29U ZsnqxlGz ivQRjOdb mB3iBEAj)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memcached
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Weaver
@@ -83,6 +83,8 @@ files:
83
83
  - TODO
84
84
  has_rdoc: true
85
85
  homepage: http://blog.evanweaver.com/files/doc/fauna/memcached/
86
+ licenses: []
87
+
86
88
  post_install_message:
87
89
  rdoc_options:
88
90
  - --line-numbers
@@ -109,9 +111,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
111
  requirements: []
110
112
 
111
113
  rubyforge_project: fauna
112
- rubygems_version: 1.3.1
114
+ rubygems_version: 1.3.4
113
115
  signing_key:
114
- specification_version: 2
116
+ specification_version: 3
115
117
  summary: An interface to the libmemcached C client.
116
118
  test_files:
117
119
  - test/test_helper.rb
metadata.gz.sig CHANGED
Binary file