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 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.2
14
- Loaded memcache-client 1.7.4
15
- user system total real
16
- set:plain:noblock:memcached:net 0.270000 0.110000 0.380000 ( 0.911797)
17
- set:plain:noblock:memcached:uds 0.250000 0.060000 0.310000 ( 0.471307)
18
- set:plain:memcached:net 0.640000 0.980000 1.620000 ( 3.662495)
19
- set:plain:memcached:uds 0.500000 0.560000 1.060000 ( 1.962946)
20
- set:plain:memcache-client 7.640000 3.200000 10.840000 ( 11.264549)
21
- set:ruby:noblock:memcached:net 0.450000 0.110000 0.560000 ( 1.049771)
22
- set:ruby:noblock:memcached:uds 0.420000 0.060000 0.480000 ( 0.581246)
23
- set:ruby:memcached:net 0.890000 0.990000 1.880000 ( 4.022136)
24
- set:ruby:memcached:uds 0.770000 0.590000 1.360000 ( 2.462128)
25
- set:ruby:memcache-client 7.210000 3.000000 10.210000 ( 12.328381)
26
- get:plain:memcached:net 0.730000 0.970000 1.700000 ( 3.866983)
27
- get:plain:memcached:uds 0.650000 0.600000 1.250000 ( 2.477487)
28
- get:plain:memcache-client 8.340000 2.910000 11.250000 ( 12.963698)
29
- get:ruby:memcached:net 0.910000 0.930000 1.840000 ( 4.232627)
30
- get:ruby:memcached:uds 0.750000 0.580000 1.330000 ( 2.107293)
31
- get:ruby:memcache-client 9.180000 3.160000 12.340000 ( 13.018086)
32
- multiget:ruby:memcached:net 0.510000 0.360000 0.870000 ( 1.286799)
33
- multiget:ruby:memcached:uds 0.500000 0.270000 0.770000 ( 0.957104)
34
- multiget:ruby:memcache-client 5.000000 1.140000 6.140000 ( 6.357939)
35
- missing:ruby:memcached:net 0.990000 1.040000 2.030000 ( 3.863125)
36
- missing:ruby:memcached:uds 0.860000 0.650000 1.510000 ( 2.375266)
37
- missing:ruby:memcached:inline 0.960000 1.030000 1.990000 ( 3.810818)
38
- missing:ruby:memcached:uds:inline 0.830000 0.640000 1.470000 ( 2.189629)
39
- missing:ruby:memcache-client 7.690000 3.180000 10.870000 ( 11.838813)
40
- mixed:ruby:noblock:memcached:net 1.840000 2.530000 4.370000 ( 8.177355)
41
- mixed:ruby:noblock:memcached:uds 1.420000 1.050000 2.470000 ( 4.167074)
42
- mixed:ruby:memcached:net 1.830000 1.980000 3.810000 ( 7.666954)
43
- mixed:ruby:memcached:uds 1.520000 1.160000 2.680000 ( 4.286830)
44
- mixed:ruby:memcache-client 17.980000 6.490000 24.470000 ( 26.107002)
45
- hash:murmur 0.040000 0.000000 0.040000 ( 0.039768)
46
- hash:default 0.040000 0.000000 0.040000 ( 0.041131)
47
- hash:jenkins 0.050000 0.000000 0.050000 ( 0.051128)
48
- hash:md5 0.090000 0.010000 0.100000 ( 0.092318)
49
- hash:crc 0.040000 0.000000 0.040000 ( 0.036825)
50
- hash:hsieh 0.020000 0.000000 0.020000 ( 0.020522)
51
- hash:fnv1_32 0.050000 0.000000 0.050000 ( 0.044151)
52
- hash:fnv1a_32 0.040000 0.000000 0.040000 ( 0.046496)
53
- hash:fnv1_64 0.100000 0.000000 0.100000 ( 0.110565)
54
- hash:fnv1a_64 0.050000 0.000000 0.050000 ( 0.052217)
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
@@ -1,4 +1,6 @@
1
1
 
2
+ v0.16.3. Optimize append/prepend on miss.
3
+
2
4
  v0.16.2. Fix memory leak.
3
5
 
4
6
  v0.16.1. Use seeded random. Fix realloc bug on Linux.
@@ -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
@@ -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
- @not_found_instance = NotFound.new
123
- @not_found_instance.no_backtrace = true
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 # Lib::MEMCACHED_SUCCESS
390
- elsif ret == Lib::MEMCACHED_BUFFERED
391
- elsif ret == Lib::MEMCACHED_NOTFOUND and !options[:show_backtraces]
392
- raise @not_found_instance
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.2"
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-02}
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"]
@@ -312,66 +312,81 @@ class Bench
312
312
 
313
313
  if defined? Memcached
314
314
  @m = Memcached.new(*@opts_networked)
315
- x.report("missing:ruby:memcached:net") do
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("missing:ruby:memcached:uds") do
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("missing:ruby:memcached:inline") do
354
+ x.report("append-miss:ruby:memcached:net") do
340
355
  n.times do
341
- @m.delete @key1 rescue nil
342
- @m.get @key1 rescue nil
343
- @m.delete @key2 rescue nil
344
- @m.get @key2 rescue nil
345
- @m.delete @key3 rescue nil
346
- @m.get @key3 rescue nil
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("missing:ruby:memcached:uds:inline") do
365
+ x.report("append-miss:ruby:memcached:uds") do
351
366
  n.times do
352
- @m.delete @key1 rescue nil
353
- @m.get @key1 rescue nil
354
- @m.delete @key2 rescue nil
355
- @m.get @key2 rescue nil
356
- @m.delete @key3 rescue nil
357
- @m.get @key3 rescue nil
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("missing:ruby:memcache-client") do
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.get @key3; rescue; end
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
- end
490
-
503
+
504
+ end
491
505
  end
492
506
  end
493
507
 
@@ -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.expects("cached_errno").returns(1)
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.2
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-02 00:00:00 -07:00
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
- t3I�r/G��&��2j#���ҩ�|���-8iwA�t ��ҡ�-��ѝ��}-�_a� ~���a�.<O��&P�Si�c5v� `���.���v��YIu��Ff®m�<�(�f������u�ԅ y0��6���}� �X<-�8�w$� 9�o���MF{�� ck���j��]*�ݔŴBz$�GXN�
2
- a��������� �*���Pa��b&s���\���e]G�&�*���v�2}e�g:l
1
+ RKy��e������[�<R��
2
+ Ru��#�1����dD %$ ����T��\€t��ሤ�4$����0&j��7����AV8��| �ΜOv��m�}���?��^e���'bddV��T�ɨ�頸���� (98���"�� �Ƀf )�O�E���{��� ��;|�߹E��X65�F5����