memcached 0.16.2 → 0.16.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/BENCHMARKS +45 -43
- data/CHANGELOG +2 -0
- data/lib/memcached/exceptions.rb +9 -12
- data/lib/memcached/memcached.rb +11 -7
- data/memcached.gemspec +2 -2
- data/test/profile/benchmark.rb +42 -28
- data/test/unit/memcached_test.rb +6 -1
- metadata +2 -2
- metadata.gz.sig +2 -2
data.tar.gz.sig
CHANGED
Binary file
|
data/BENCHMARKS
CHANGED
@@ -9,47 +9,49 @@ You can easily run your own benchmarks, as long as you have memcached itself on
|
|
9
9
|
|
10
10
|
These benchmarks were run on an OS X 10.5 Core 2 Duo machine (10,000 iterations):
|
11
11
|
|
12
|
-
Ruby 1.8.7p174
|
13
|
-
Loaded memcached 0.16.
|
14
|
-
Loaded memcache-client 1.7.4
|
15
|
-
|
16
|
-
|
17
|
-
set:plain:noblock:memcached:
|
18
|
-
set:plain:memcached:
|
19
|
-
set:plain:memcached:
|
20
|
-
set:plain:
|
21
|
-
set:
|
22
|
-
set:ruby:noblock:memcached:
|
23
|
-
set:ruby:memcached:
|
24
|
-
set:ruby:memcached:
|
25
|
-
set:ruby:
|
26
|
-
|
27
|
-
get:plain:memcached:
|
28
|
-
get:plain:
|
29
|
-
get:
|
30
|
-
get:ruby:memcached:
|
31
|
-
get:ruby:
|
32
|
-
|
33
|
-
multiget:ruby:memcached:
|
34
|
-
multiget:ruby:
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
mixed:ruby:memcached:net
|
43
|
-
mixed:ruby:memcached:uds
|
44
|
-
mixed:ruby:
|
45
|
-
|
46
|
-
|
47
|
-
hash:
|
48
|
-
hash:
|
49
|
-
hash:
|
50
|
-
hash:
|
51
|
-
hash:
|
52
|
-
hash:fnv1a_32 0.
|
53
|
-
hash:
|
54
|
-
hash:
|
12
|
+
Ruby 1.8.7p174
|
13
|
+
Loaded memcached 0.16.3
|
14
|
+
Loaded memcache-client 1.7.4
|
15
|
+
|
16
|
+
user system total real
|
17
|
+
set:plain:noblock:memcached:net 0.260000 0.110000 0.370000 ( 0.941733)
|
18
|
+
set:plain:noblock:memcached:uds 0.250000 0.060000 0.310000 ( 0.470593)
|
19
|
+
set:plain:memcached:net 0.640000 1.040000 1.680000 ( 4.352426)
|
20
|
+
set:plain:memcached:uds 0.500000 0.560000 1.060000 ( 2.130330)
|
21
|
+
set:plain:memcache-client 7.500000 3.160000 10.660000 ( 11.394051)
|
22
|
+
set:ruby:noblock:memcached:net 0.430000 0.070000 0.500000 ( 1.393856)
|
23
|
+
set:ruby:noblock:memcached:uds 0.440000 0.040000 0.480000 ( 0.751106)
|
24
|
+
set:ruby:memcached:net 0.890000 0.910000 1.800000 ( 5.539385)
|
25
|
+
set:ruby:memcached:uds 0.790000 0.610000 1.400000 ( 3.257946)
|
26
|
+
set:ruby:memcache-client 7.710000 3.160000 10.870000 ( 11.494342)
|
27
|
+
get:plain:memcached:net 0.730000 0.940000 1.670000 ( 4.305591)
|
28
|
+
get:plain:memcached:uds 0.610000 0.580000 1.190000 ( 2.225602)
|
29
|
+
get:plain:memcache-client 8.960000 3.110000 12.070000 ( 13.710735)
|
30
|
+
get:ruby:memcached:net 0.910000 0.980000 1.890000 ( 4.364018)
|
31
|
+
get:ruby:memcached:uds 0.750000 0.570000 1.320000 ( 2.236862)
|
32
|
+
get:ruby:memcache-client 9.310000 3.180000 12.490000 ( 13.077060)
|
33
|
+
multiget:ruby:memcached:net 0.510000 0.350000 0.860000 ( 1.471429)
|
34
|
+
multiget:ruby:memcached:uds 0.500000 0.260000 0.760000 ( 1.138027)
|
35
|
+
multiget:ruby:memcache-client 4.840000 1.110000 5.950000 ( 6.511808)
|
36
|
+
get-miss:ruby:memcached:net 0.960000 1.030000 1.990000 ( 4.510132)
|
37
|
+
get-miss:ruby:memcached:uds 0.830000 0.640000 1.470000 ( 2.708862)
|
38
|
+
get-miss:ruby:memcache-client 7.810000 3.190000 11.000000 ( 11.390215)
|
39
|
+
append-miss:ruby:memcached:net 1.000000 1.030000 2.030000 ( 4.923893)
|
40
|
+
append-miss:ruby:memcached:uds 0.890000 0.680000 1.570000 ( 3.202743)
|
41
|
+
append-miss:ruby:memcache-client 7.740000 3.180000 10.920000 ( 11.339136)
|
42
|
+
mixed:ruby:noblock:memcached:net 1.800000 2.370000 4.170000 ( 8.616549)
|
43
|
+
mixed:ruby:noblock:memcached:uds 1.410000 1.090000 2.500000 ( 5.035893)
|
44
|
+
mixed:ruby:memcached:net 1.830000 1.900000 3.730000 ( 9.046367)
|
45
|
+
mixed:ruby:memcached:uds 1.570000 1.190000 2.760000 ( 6.583020)
|
46
|
+
mixed:ruby:memcache-client 17.910000 6.440000 24.350000 ( 24.946386)
|
47
|
+
hash:murmur 0.040000 0.000000 0.040000 ( 0.039152)
|
48
|
+
hash:default 0.040000 0.000000 0.040000 ( 0.041841)
|
49
|
+
hash:jenkins 0.050000 0.000000 0.050000 ( 0.052283)
|
50
|
+
hash:md5 0.090000 0.000000 0.090000 ( 0.092901)
|
51
|
+
hash:crc 0.040000 0.000000 0.040000 ( 0.037710)
|
52
|
+
hash:fnv1a_32 0.050000 0.000000 0.050000 ( 0.047746)
|
53
|
+
hash:hsieh 0.020000 0.000000 0.020000 ( 0.020477)
|
54
|
+
hash:fnv1_32 0.050000 0.000000 0.050000 ( 0.046204)
|
55
|
+
hash:fnv1_64 0.100000 0.000000 0.100000 ( 0.106735)
|
56
|
+
hash:fnv1a_64 0.060000 0.000000 0.060000 ( 0.054646)
|
55
57
|
|
data/CHANGELOG
CHANGED
data/lib/memcached/exceptions.rb
CHANGED
@@ -47,6 +47,15 @@ Subclasses correspond one-to-one with server response strings or libmemcached er
|
|
47
47
|
|
48
48
|
=end
|
49
49
|
class Error < RuntimeError
|
50
|
+
attr_accessor :no_backtrace
|
51
|
+
|
52
|
+
def set_backtrace(*args)
|
53
|
+
@no_backtrace ? [] : super
|
54
|
+
end
|
55
|
+
|
56
|
+
def backtrace(*args)
|
57
|
+
@no_backtrace ? [] : super
|
58
|
+
end
|
50
59
|
end
|
51
60
|
|
52
61
|
#:stopdoc:
|
@@ -71,17 +80,5 @@ Subclasses correspond one-to-one with server response strings or libmemcached er
|
|
71
80
|
EXCEPTIONS << exception_class
|
72
81
|
end
|
73
82
|
|
74
|
-
class NotFound
|
75
|
-
attr_accessor :no_backtrace
|
76
|
-
|
77
|
-
def set_backtrace(*args)
|
78
|
-
@no_backtrace ? [] : super
|
79
|
-
end
|
80
|
-
|
81
|
-
def backtrace(*args)
|
82
|
-
@no_backtrace ? [] : super
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
83
|
#:startdoc:
|
87
84
|
end
|
data/lib/memcached/memcached.rb
CHANGED
@@ -63,7 +63,7 @@ Valid option parameters are:
|
|
63
63
|
<tt>:tcp_nodelay</tt>:: Turns on the no-delay feature for connecting sockets. Accepts <tt>true</tt> or <tt>false</tt>. Performance may or may not change, depending on your system.
|
64
64
|
<tt>:no_block</tt>:: Whether to use pipelining for writes. Accepts <tt>true</tt> or <tt>false</tt>.
|
65
65
|
<tt>:buffer_requests</tt>:: Whether to use an internal write buffer. Accepts <tt>true</tt> or <tt>false</tt>. Calling <tt>get</tt> or closing the connection will force the buffer to flush. Note that <tt>:buffer_requests</tt> might not work well without <tt>:no_block</tt> also enabled.
|
66
|
-
<tt>:show_backtraces</tt>:: Whether <b>Memcached::NotFound</b> exceptions should include backtraces. Generating backtraces is slow, so this is off by default. Turn it on to ease debugging.
|
66
|
+
<tt>:show_backtraces</tt>:: Whether <b>Memcached::NotFound</b> and <b>Memcached::NotStored</b> exceptions should include backtraces. Generating backtraces is slow, so this is off by default. Turn it on to ease debugging.
|
67
67
|
<tt>:connect_timeout</tt>:: How long to wait for a connection to a server. Defaults to 2 seconds. Set to <tt>0</tt> if you want to wait forever.
|
68
68
|
<tt>:timeout</tt>:: How long to wait for a response from the server. Defaults to 0.25 seconds. Set to <tt>0</tt> if you want to wait forever.
|
69
69
|
<tt>:default_ttl</tt>:: The <tt>ttl</tt> to use on set if no <tt>ttl</tt> is specified, in seconds. Defaults to one week. Set to <tt>0</tt> if you want things to never expire.
|
@@ -119,8 +119,10 @@ Please note that when pipelining is enabled, setter and deleter methods do not r
|
|
119
119
|
|
120
120
|
# Not found exceptions
|
121
121
|
unless options[:show_backtraces]
|
122
|
-
@
|
123
|
-
@
|
122
|
+
@not_found = NotFound.new
|
123
|
+
@not_found.no_backtrace = true
|
124
|
+
@not_stored = NotStored.new
|
125
|
+
@not_stored.no_backtrace = true
|
124
126
|
end
|
125
127
|
end
|
126
128
|
|
@@ -386,10 +388,12 @@ Please note that when pipelining is enabled, setter and deleter methods do not r
|
|
386
388
|
|
387
389
|
# Checks the return code from Rlibmemcached against the exception list. Raises the corresponding exception if the return code is not Memcached::Success or Memcached::ActionQueued. Accepts an integer return code and an optional key, for exception messages.
|
388
390
|
def check_return_code(ret, key = nil) #:doc:
|
389
|
-
if ret == 0 #
|
390
|
-
elsif ret == Lib::MEMCACHED_BUFFERED
|
391
|
-
elsif ret == Lib::MEMCACHED_NOTFOUND and
|
392
|
-
raise @
|
391
|
+
if ret == 0 # Memcached::Success
|
392
|
+
elsif ret == Lib::MEMCACHED_BUFFERED # Memcached::ActionQueued
|
393
|
+
elsif ret == Lib::MEMCACHED_NOTFOUND and @not_found
|
394
|
+
raise @not_found
|
395
|
+
elsif ret == Lib::MEMCACHED_NOTSTORED and @not_stored
|
396
|
+
raise @not_stored
|
393
397
|
else
|
394
398
|
message = "Key #{inspect_keys(key, (detect_failure if ret == Lib::MEMCACHED_SERVER_MARKED_DEAD)).inspect}"
|
395
399
|
if key.is_a?(String)
|
data/memcached.gemspec
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{memcached}
|
5
|
-
s.version = "0.16.
|
5
|
+
s.version = "0.16.3"
|
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"]
|
9
9
|
s.cert_chain = ["/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-public_cert.pem"]
|
10
|
-
s.date = %q{2009-09-
|
10
|
+
s.date = %q{2009-09-04}
|
11
11
|
s.description = %q{An interface to the libmemcached C client.}
|
12
12
|
s.email = %q{}
|
13
13
|
s.extensions = ["ext/extconf.rb"]
|
data/test/profile/benchmark.rb
CHANGED
@@ -312,66 +312,81 @@ class Bench
|
|
312
312
|
|
313
313
|
if defined? Memcached
|
314
314
|
@m = Memcached.new(*@opts_networked)
|
315
|
-
x.report("
|
315
|
+
x.report("get-miss:ruby:memcached:net") do
|
316
316
|
n.times do
|
317
317
|
begin @m.delete @key1; rescue Memcached::NotFound; end
|
318
|
-
begin @m.get @key1; rescue Memcached::NotFound; end
|
319
318
|
begin @m.delete @key2; rescue Memcached::NotFound; end
|
320
|
-
begin @m.get @key2; rescue Memcached::NotFound; end
|
321
319
|
begin @m.delete @key3; rescue Memcached::NotFound; end
|
320
|
+
begin @m.get @key1; rescue Memcached::NotFound; end
|
321
|
+
begin @m.get @key2; rescue Memcached::NotFound; end
|
322
322
|
begin @m.get @key3; rescue Memcached::NotFound; end
|
323
323
|
end
|
324
324
|
end
|
325
325
|
@m = Memcached.new(*@opt_unix)
|
326
|
-
x.report("
|
326
|
+
x.report("get-miss:ruby:memcached:uds") do
|
327
327
|
n.times do
|
328
328
|
begin @m.delete @key1; rescue Memcached::NotFound; end
|
329
|
-
begin @m.get @key1; rescue Memcached::NotFound; end
|
330
329
|
begin @m.delete @key2; rescue Memcached::NotFound; end
|
331
|
-
begin @m.get @key2; rescue Memcached::NotFound; end
|
332
330
|
begin @m.delete @key3; rescue Memcached::NotFound; end
|
331
|
+
begin @m.get @key1; rescue Memcached::NotFound; end
|
332
|
+
begin @m.get @key2; rescue Memcached::NotFound; end
|
333
333
|
begin @m.get @key3; rescue Memcached::NotFound; end
|
334
334
|
end
|
335
335
|
end
|
336
|
+
end
|
337
|
+
|
338
|
+
if defined? MemCache
|
339
|
+
@m = MemCache.new(*@opts_networked)
|
340
|
+
x.report("get-miss:ruby:memcache-client") do
|
341
|
+
n.times do
|
342
|
+
begin @m.delete @key1; rescue; end
|
343
|
+
begin @m.delete @key2; rescue; end
|
344
|
+
begin @m.delete @key3; rescue; end
|
345
|
+
begin @m.get @key1; rescue; end
|
346
|
+
begin @m.get @key2; rescue; end
|
347
|
+
begin @m.get @key3; rescue; end
|
348
|
+
end
|
349
|
+
end
|
336
350
|
end
|
351
|
+
|
337
352
|
if defined? Memcached
|
338
353
|
@m = Memcached.new(*@opts_networked)
|
339
|
-
x.report("
|
354
|
+
x.report("append-miss:ruby:memcached:net") do
|
340
355
|
n.times do
|
341
|
-
@m.delete @key1 rescue
|
342
|
-
@m.
|
343
|
-
@m.delete @
|
344
|
-
@m.
|
345
|
-
@m.
|
346
|
-
@m.
|
356
|
+
begin @m.delete @key1; rescue Memcached::NotFound; end
|
357
|
+
begin @m.delete @key2; rescue Memcached::NotFound; end
|
358
|
+
begin @m.delete @key3; rescue Memcached::NotFound; end
|
359
|
+
begin @m.append @key1, @value; rescue Memcached::NotStored; end
|
360
|
+
begin @m.append @key2, @value; rescue Memcached::NotStored; end
|
361
|
+
begin @m.append @key3, @value; rescue Memcached::NotStored; end
|
347
362
|
end
|
348
363
|
end
|
349
364
|
@m = Memcached.new(*@opt_unix)
|
350
|
-
x.report("
|
365
|
+
x.report("append-miss:ruby:memcached:uds") do
|
351
366
|
n.times do
|
352
|
-
@m.delete @key1 rescue
|
353
|
-
@m.
|
354
|
-
@m.delete @
|
355
|
-
@m.
|
356
|
-
@m.
|
357
|
-
@m.
|
367
|
+
begin @m.delete @key1; rescue Memcached::NotFound; end
|
368
|
+
begin @m.delete @key2; rescue Memcached::NotFound; end
|
369
|
+
begin @m.delete @key3; rescue Memcached::NotFound; end
|
370
|
+
begin @m.append @key1, @value; rescue Memcached::NotStored; end
|
371
|
+
begin @m.append @key2, @value; rescue Memcached::NotStored; end
|
372
|
+
begin @m.append @key3, @value; rescue Memcached::NotStored; end
|
358
373
|
end
|
359
374
|
end
|
360
375
|
end
|
361
376
|
if defined? MemCache
|
362
377
|
@m = MemCache.new(*@opts_networked)
|
363
|
-
x.report("
|
378
|
+
x.report("append-miss:ruby:memcache-client") do
|
364
379
|
n.times do
|
365
380
|
begin @m.delete @key1; rescue; end
|
366
|
-
begin @m.get @key1; rescue; end
|
367
381
|
begin @m.delete @key2; rescue; end
|
368
|
-
begin @m.get @key2; rescue; end
|
369
382
|
begin @m.delete @key3; rescue; end
|
370
|
-
begin @m.
|
383
|
+
begin @m.append @key1, @value; rescue; end
|
384
|
+
begin @m.append @key2, @value; rescue; end
|
385
|
+
begin @m.append @key3, @value; rescue; end
|
371
386
|
end
|
372
387
|
end
|
373
388
|
end
|
374
|
-
|
389
|
+
|
375
390
|
if defined? Memcached
|
376
391
|
@m = Memcached.new(
|
377
392
|
@opts_networked[0],
|
@@ -484,10 +499,9 @@ class Bench
|
|
484
499
|
end
|
485
500
|
end
|
486
501
|
end
|
487
|
-
|
488
502
|
end
|
489
|
-
|
490
|
-
|
503
|
+
|
504
|
+
end
|
491
505
|
end
|
492
506
|
end
|
493
507
|
|
data/test/unit/memcached_test.rb
CHANGED
@@ -155,6 +155,11 @@ class MemcachedTest < Test::Unit::TestCase
|
|
155
155
|
rescue Memcached::NotFound => e
|
156
156
|
assert e.backtrace.empty?
|
157
157
|
end
|
158
|
+
begin
|
159
|
+
cache.append key, @value
|
160
|
+
rescue Memcached::NotStored => e
|
161
|
+
assert e.backtrace.empty?
|
162
|
+
end
|
158
163
|
end
|
159
164
|
|
160
165
|
def test_initialize_with_backtraces
|
@@ -697,7 +702,7 @@ class MemcachedTest < Test::Unit::TestCase
|
|
697
702
|
end
|
698
703
|
|
699
704
|
def test_errno_message
|
700
|
-
Rlibmemcached::MemcachedServerSt.any_instance.
|
705
|
+
Rlibmemcached::MemcachedServerSt.any_instance.stubs("cached_errno").returns(1)
|
701
706
|
@cache.send(:check_return_code, Rlibmemcached::MEMCACHED_ERRNO, key)
|
702
707
|
rescue Memcached::SystemError => e
|
703
708
|
assert_match /^Errno 1: "Operation not permitted". Key/, e.message
|
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.16.
|
4
|
+
version: 0.16.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Weaver
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
yZ0=
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
|
33
|
-
date: 2009-09-
|
33
|
+
date: 2009-09-04 00:00:00 -07:00
|
34
34
|
default_executable:
|
35
35
|
dependencies: []
|
36
36
|
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
�
|
1
|
+
RK�y��e������[�<R��
|
2
|
+
R�u��#�1����d�D%$ ����T��\t��ሤ�4$����0&j��7����AV8��| �ΜOv��m�}���?��^e���'bd�d�V��T�ɨ�頸���� (98���"�� �Ƀf )�O�E���{�����;|�߹E��X65�F5����
|