memcached 1.1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +3 -4
- data/BENCHMARKS +102 -104
- data/CHANGELOG +2 -0
- data/Manifest +4 -1
- data/Rakefile +12 -6
- data/lib/memcached/memcached.rb +33 -27
- data/lib/rlibmemcached.bundle.dSYM/Contents/Info.plist +20 -0
- data/memcached.gemspec +4 -4
- data/test/profile/benchmark.rb +4 -0
- data/test/profile/c_profiler.rb +14 -0
- data/test/profile/exercise.rb +150 -0
- data/test/profile/rb_profiler.rb +21 -0
- data/test/profile/valgrind.rb +1 -147
- data/test/unit/memcached_test.rb +30 -16
- metadata +9 -5
- metadata.gz.sig +0 -0
- data/test/profile/profile.rb +0 -14
data.tar.gz.sig
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
㩙O���6@k�Š��ު��y�"�
|
1
|
+
|
2
|
+
�MY���i�3+�7T3��Lلh���<����s$��.:��?���ZU�&���ZVc<f�Bf�}Fe��Ft0y�h�h?=8Irk���W��X�s�{���G��:/)
|
3
|
+
�������4��"+�x5x��A����A���Fc}���C:<�����r��ʶ�V��w����d����c��7M���nޟc8�B����]y�ik�\ ��$�A���99!��k���!GP�ґ�A�y��{&�F��
|
data/BENCHMARKS
CHANGED
@@ -20,117 +20,115 @@ These benchmarks were run on a 64-bit OS X machine, with memcached 1.4.5:
|
|
20
20
|
RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
|
21
21
|
RUBY_VERSION=ree-1.8.7-2010.02
|
22
22
|
Ruby 1.8.7p253
|
23
|
-
Loaded memcached 1.1
|
23
|
+
Loaded memcached 1.1.1
|
24
24
|
Loaded remix-stash 1.1.3
|
25
25
|
Loaded memcache-client 1.8.5
|
26
26
|
Loaded kgio 2.0.0
|
27
27
|
Loaded dalli 1.0.2
|
28
|
+
PID is 21173
|
28
29
|
Loops is 20000
|
29
30
|
Stack depth is 0
|
30
31
|
Small value size is: 13 bytes
|
31
32
|
Large value size is: 4158 bytes
|
32
33
|
|
33
34
|
user system total real
|
34
|
-
set:
|
35
|
-
set: libm:ascii
|
36
|
-
set: libm:ascii:
|
37
|
-
set: libm:
|
38
|
-
set: libm:bin
|
39
|
-
set:
|
40
|
-
set: mclient:ascii 7.
|
41
|
-
set: stash:bin 2.
|
42
|
-
|
43
|
-
get:
|
44
|
-
get: libm:ascii
|
45
|
-
get: libm:ascii:
|
46
|
-
get: libm:
|
47
|
-
get: libm:bin
|
48
|
-
get:
|
49
|
-
get: mclient:ascii 8.
|
50
|
-
get: stash:bin 2.
|
51
|
-
|
52
|
-
get-multi:
|
53
|
-
get-multi: libm:ascii
|
54
|
-
get-multi: libm:ascii:
|
55
|
-
get-multi: libm:
|
56
|
-
get-multi: libm:bin
|
57
|
-
get-multi:
|
58
|
-
|
59
|
-
append:
|
60
|
-
append: libm:ascii
|
61
|
-
append: libm:ascii:
|
62
|
-
append: libm:
|
63
|
-
append: libm:bin
|
64
|
-
append:
|
65
|
-
append: mclient:ascii 7.
|
66
|
-
|
67
|
-
prepend:
|
68
|
-
prepend: libm:ascii
|
69
|
-
prepend: libm:ascii:
|
70
|
-
prepend: libm:
|
71
|
-
prepend: libm:bin
|
72
|
-
prepend:
|
73
|
-
prepend: mclient:ascii
|
74
|
-
|
75
|
-
delete:
|
76
|
-
delete: libm:ascii
|
77
|
-
delete: libm:ascii:
|
78
|
-
delete: libm:
|
79
|
-
delete: libm:bin
|
80
|
-
delete:
|
81
|
-
delete: mclient:ascii
|
82
|
-
|
83
|
-
get-missing:
|
84
|
-
get-missing: libm:ascii
|
85
|
-
get-missing: libm:ascii:
|
86
|
-
get-missing: libm:
|
87
|
-
get-missing: libm:bin
|
88
|
-
get-missing:
|
89
|
-
get-missing: mclient:ascii
|
90
|
-
|
91
|
-
append-missing:
|
92
|
-
append-missing: libm:ascii
|
93
|
-
append-missing: libm:ascii:
|
94
|
-
append-missing: libm:
|
95
|
-
append-missing:
|
96
|
-
append-missing: mclient:ascii 6.
|
97
|
-
|
98
|
-
prepend-missing:
|
99
|
-
prepend-missing: libm:ascii
|
100
|
-
prepend-missing: libm:ascii:
|
101
|
-
prepend-missing: libm:
|
102
|
-
prepend-missing:
|
103
|
-
prepend-missing: mclient:ascii 7.
|
104
|
-
|
105
|
-
set-large:
|
106
|
-
set-large: libm:ascii
|
107
|
-
set-large: libm:ascii:
|
108
|
-
set-large: libm:
|
109
|
-
set-large: libm:bin
|
110
|
-
set-large:
|
111
|
-
set-large: mclient:ascii 7.
|
112
|
-
set-large: stash:bin 3.
|
113
|
-
|
114
|
-
get-large:
|
115
|
-
get-large: libm:ascii
|
116
|
-
get-large: libm:ascii:
|
117
|
-
get-large: libm:
|
118
|
-
get-large: libm:bin
|
119
|
-
get-large:
|
120
|
-
get-large: mclient:ascii 8.
|
121
|
-
get-large: stash:bin 2.
|
122
|
-
|
123
|
-
hash:murmur 0.
|
124
|
-
hash:md5 0.
|
125
|
-
hash:fnv1a_64 0.
|
126
|
-
hash:fnv1a_32 0.310000 0.
|
127
|
-
hash:jenkins 0.270000 0.
|
128
|
-
hash:default 0.
|
129
|
-
hash:crc 0.
|
130
|
-
hash:hsieh 0.210000 0.000000 0.210000 ( 0.
|
131
|
-
hash:fnv1_32 0.310000 0.000000 0.310000 ( 0.
|
132
|
-
hash:fnv1_64 0.
|
133
|
-
hash:none 0.
|
134
|
-
|
135
|
-
|
136
|
-
|
35
|
+
set: libm:ascii 0.600000 0.960000 1.560000 ( 3.790868)
|
36
|
+
set: libm:ascii:pipeline 0.230000 0.010000 0.240000 ( 0.240365)
|
37
|
+
set: libm:ascii:udp 0.530000 0.580000 1.110000 ( 2.573610)
|
38
|
+
set: libm:bin 0.480000 0.860000 1.340000 ( 3.355849)
|
39
|
+
set: libm:bin:buffer 0.250000 0.100000 0.350000 ( 0.859416)
|
40
|
+
set: dalli:bin 4.270000 1.380000 5.650000 ( 7.673922)
|
41
|
+
set: mclient:ascii 7.020000 1.920000 8.940000 ( 9.739894)
|
42
|
+
set: stash:bin 2.640000 1.060000 3.700000 ( 6.100208)
|
43
|
+
|
44
|
+
get: libm:ascii 0.830000 0.990000 1.820000 ( 3.912925)
|
45
|
+
get: libm:ascii:pipeline 0.780000 1.070000 1.850000 ( 4.166414)
|
46
|
+
get: libm:ascii:udp 0.680000 0.620000 1.300000 ( 2.872687)
|
47
|
+
get: libm:bin 0.690000 1.020000 1.710000 ( 3.588579)
|
48
|
+
get: libm:bin:buffer 0.690000 1.210000 1.900000 ( 3.927647)
|
49
|
+
get: dalli:bin 4.530000 1.490000 6.020000 ( 8.197772)
|
50
|
+
get: mclient:ascii 8.660000 1.870000 10.530000 ( 11.176572)
|
51
|
+
get: stash:bin 2.310000 1.000000 3.310000 ( 5.581331)
|
52
|
+
|
53
|
+
get-multi: libm:ascii 0.650000 0.560000 1.210000 ( 2.101080)
|
54
|
+
get-multi: libm:ascii:pipeline 0.750000 0.560000 1.310000 ( 2.188553)
|
55
|
+
get-multi: libm:ascii:udp 0.710000 0.470000 1.180000 ( 1.680744)
|
56
|
+
get-multi: libm:bin 0.730000 0.800000 1.530000 ( 4.046271)
|
57
|
+
get-multi: libm:bin:buffer 0.710000 0.670000 1.380000 ( 2.853617)
|
58
|
+
get-multi: dalli:bin 7.700000 2.190000 9.890000 ( 10.021851)
|
59
|
+
|
60
|
+
append: libm:ascii 0.740000 1.000000 1.740000 ( 5.609197)
|
61
|
+
append: libm:ascii:pipeline 0.250000 0.010000 0.260000 ( 0.875205)
|
62
|
+
append: libm:ascii:udp 0.570000 0.560000 1.130000 ( 4.695231)
|
63
|
+
append: libm:bin 0.540000 0.900000 1.440000 ( 4.962085)
|
64
|
+
append: libm:bin:buffer 0.560000 0.780000 1.340000 ( 2.669085)
|
65
|
+
append: dalli:bin 3.620000 1.240000 4.860000 ( 8.718248)
|
66
|
+
append: mclient:ascii 7.220000 1.750000 8.970000 ( 11.657408)
|
67
|
+
|
68
|
+
prepend: libm:ascii 0.660000 1.040000 1.700000 ( 5.461676)
|
69
|
+
prepend: libm:ascii:pipeline 0.260000 0.010000 0.270000 ( 0.760103)
|
70
|
+
prepend: libm:ascii:udp 0.670000 0.600000 1.270000 ( 4.324850)
|
71
|
+
prepend: libm:bin 0.560000 0.900000 1.460000 ( 5.801869)
|
72
|
+
prepend: libm:bin:buffer 0.530000 0.800000 1.330000 ( 3.631074)
|
73
|
+
prepend: dalli:bin 3.620000 1.240000 4.860000 ( 8.531561)
|
74
|
+
prepend: mclient:ascii 6.400000 1.590000 7.990000 ( 12.047692)
|
75
|
+
|
76
|
+
delete: libm:ascii 1.350000 0.920000 2.270000 ( 4.693438)
|
77
|
+
delete: libm:ascii:pipeline 0.320000 0.320000 0.640000 ( 0.706662)
|
78
|
+
delete: libm:ascii:udp 1.270000 0.660000 1.930000 ( 3.851781)
|
79
|
+
delete: libm:bin 1.190000 0.960000 2.150000 ( 4.456707)
|
80
|
+
delete: libm:bin:buffer 0.230000 0.250000 0.480000 ( 0.911735)
|
81
|
+
delete: dalli:bin 3.850000 1.440000 5.290000 ( 7.160706)
|
82
|
+
delete: mclient:ascii 7.270000 1.670000 8.940000 ( 9.618969)
|
83
|
+
|
84
|
+
get-missing: libm:ascii 1.430000 0.970000 2.400000 ( 4.982100)
|
85
|
+
get-missing: libm:ascii:pipeline 1.480000 1.200000 2.680000 ( 5.505560)
|
86
|
+
get-missing: libm:ascii:udp 1.340000 0.690000 2.030000 ( 3.706029)
|
87
|
+
get-missing: libm:bin 1.390000 0.960000 2.350000 ( 4.676127)
|
88
|
+
get-missing: libm:bin:buffer 1.460000 1.230000 2.690000 ( 5.048332)
|
89
|
+
get-missing: dalli:bin 3.810000 1.380000 5.190000 ( 7.874001)
|
90
|
+
get-missing: mclient:ascii 6.920000 1.600000 8.520000 ( 9.999317)
|
91
|
+
|
92
|
+
append-missing: libm:ascii 1.370000 0.990000 2.360000 ( 5.073530)
|
93
|
+
append-missing: libm:ascii:pipeline 0.330000 0.010000 0.340000 ( 0.374423)
|
94
|
+
append-missing: libm:ascii:udp 1.300000 0.690000 1.990000 ( 4.005369)
|
95
|
+
append-missing: libm:bin 1.340000 0.920000 2.260000 ( 5.339037)
|
96
|
+
append-missing: dalli:bin 4.020000 1.420000 5.440000 ( 8.193874)
|
97
|
+
append-missing: mclient:ascii 6.930000 1.630000 8.560000 ( 10.637547)
|
98
|
+
|
99
|
+
prepend-missing: libm:ascii 1.460000 0.970000 2.430000 ( 5.002199)
|
100
|
+
prepend-missing: libm:ascii:pipeline 0.240000 0.010000 0.250000 ( 0.253590)
|
101
|
+
prepend-missing: libm:ascii:udp 1.370000 0.710000 2.080000 ( 4.243274)
|
102
|
+
prepend-missing: libm:bin 1.360000 0.950000 2.310000 ( 4.946014)
|
103
|
+
prepend-missing: dalli:bin 3.910000 1.430000 5.340000 ( 7.407236)
|
104
|
+
prepend-missing: mclient:ascii 7.380000 1.730000 9.110000 ( 10.140385)
|
105
|
+
|
106
|
+
set-large: libm:ascii 0.670000 0.980000 1.650000 ( 5.181314)
|
107
|
+
set-large: libm:ascii:pipeline 0.410000 0.330000 0.740000 ( 1.757769)
|
108
|
+
set-large: libm:ascii:udp 0.590000 0.670000 1.260000 ( 3.510175)
|
109
|
+
set-large: libm:bin 0.540000 0.980000 1.520000 ( 3.878854)
|
110
|
+
set-large: libm:bin:buffer 0.350000 0.440000 0.790000 ( 2.036610)
|
111
|
+
set-large: dalli:bin 5.010000 1.670000 6.680000 ( 9.884379)
|
112
|
+
set-large: mclient:ascii 7.500000 2.130000 9.630000 ( 11.357448)
|
113
|
+
set-large: stash:bin 3.920000 1.130000 5.050000 ( 7.488534)
|
114
|
+
|
115
|
+
get-large: libm:ascii 0.760000 0.950000 1.710000 ( 4.151140)
|
116
|
+
get-large: libm:ascii:pipeline 0.820000 1.190000 2.010000 ( 4.079482)
|
117
|
+
get-large: libm:ascii:udp 0.770000 0.580000 1.350000 ( 2.763797)
|
118
|
+
get-large: libm:bin 0.640000 0.970000 1.610000 ( 3.686591)
|
119
|
+
get-large: libm:bin:buffer 0.690000 1.110000 1.800000 ( 3.974967)
|
120
|
+
get-large: dalli:bin 4.710000 1.430000 6.140000 ( 8.011834)
|
121
|
+
get-large: mclient:ascii 8.860000 1.970000 10.830000 ( 12.136812)
|
122
|
+
get-large: stash:bin 2.420000 0.970000 3.390000 ( 5.643309)
|
123
|
+
|
124
|
+
hash:murmur 0.250000 0.000000 0.250000 ( 0.250730)
|
125
|
+
hash:md5 0.670000 0.000000 0.670000 ( 0.680286)
|
126
|
+
hash:fnv1a_64 0.320000 0.000000 0.320000 ( 0.319818)
|
127
|
+
hash:fnv1a_32 0.310000 0.000000 0.310000 ( 0.328325)
|
128
|
+
hash:jenkins 0.270000 0.010000 0.280000 ( 0.270705)
|
129
|
+
hash:default 0.410000 0.000000 0.410000 ( 0.412068)
|
130
|
+
hash:crc 0.380000 0.000000 0.380000 ( 0.377563)
|
131
|
+
hash:hsieh 0.210000 0.000000 0.210000 ( 0.212948)
|
132
|
+
hash:fnv1_32 0.310000 0.000000 0.310000 ( 0.316208)
|
133
|
+
hash:fnv1_64 0.450000 0.000000 0.450000 ( 0.453148)
|
134
|
+
hash:none 0.210000 0.000000 0.210000 ( 0.213811)
|
data/CHANGELOG
CHANGED
data/Manifest
CHANGED
@@ -24,8 +24,11 @@ lib/memcached/exceptions.rb
|
|
24
24
|
lib/memcached/experimental.rb
|
25
25
|
lib/memcached/memcached.rb
|
26
26
|
lib/memcached/rails.rb
|
27
|
+
lib/rlibmemcached.bundle.dSYM/Contents/Info.plist
|
27
28
|
test/profile/benchmark.rb
|
28
|
-
test/profile/
|
29
|
+
test/profile/c_profiler.rb
|
30
|
+
test/profile/exercise.rb
|
31
|
+
test/profile/rb_profiler.rb
|
29
32
|
test/profile/valgrind.rb
|
30
33
|
test/setup.rb
|
31
34
|
test/teardown.rb
|
data/Rakefile
CHANGED
@@ -4,8 +4,6 @@ Echoe.new("memcached") do |p|
|
|
4
4
|
p.author = "Evan Weaver"
|
5
5
|
p.project = "fauna"
|
6
6
|
p.summary = "An interface to the libmemcached C client."
|
7
|
-
p.url = "http://blog.evanweaver.com/files/doc/fauna/memcached/"
|
8
|
-
p.docs_host = "blog.evanweaver.com:~/www/bax/public/files/doc/"
|
9
7
|
p.rdoc_pattern = /README|TODO|LICENSE|CHANGELOG|BENCH|COMPAT|exceptions|experimental.rb|behaviors|rails.rb|memcached.rb/
|
10
8
|
p.clean_pattern += ["ext/lib", "ext/include", "ext/share", "ext/libmemcached-?.??", "ext/bin", "ext/conftest.dSYM"]
|
11
9
|
end
|
@@ -22,10 +20,18 @@ task :exceptions do
|
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
25
|
-
task :
|
26
|
-
|
23
|
+
task :benchmark do
|
24
|
+
exec("ruby #{File.dirname(__FILE__)}/test/profile/benchmark.rb")
|
25
|
+
end
|
26
|
+
|
27
|
+
task :rb_profile do
|
28
|
+
exec("ruby #{File.dirname(__FILE__)}/test/profile/rb_profiler.rb")
|
27
29
|
end
|
28
30
|
|
29
|
-
task :
|
30
|
-
exec("ruby #{File.dirname(__FILE__)}/test/profile/
|
31
|
+
task :c_profile do
|
32
|
+
exec("ruby #{File.dirname(__FILE__)}/test/profile/c_profiler.rb")
|
33
|
+
end
|
34
|
+
|
35
|
+
task :valgrind do
|
36
|
+
exec("ruby #{File.dirname(__FILE__)}/test/profile/valgrind.rb")
|
31
37
|
end
|
data/lib/memcached/memcached.rb
CHANGED
@@ -308,7 +308,7 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
|
|
308
308
|
# Also accepts a <tt>marshal</tt> value, which defaults to <tt>true</tt>. Set <tt>marshal</tt> to <tt>false</tt> if you want the <tt>value</tt> to be set directly.
|
309
309
|
#
|
310
310
|
def set(key, value, ttl=@default_ttl, marshal=true, flags=FLAGS)
|
311
|
-
value = marshal ? Marshal.dump(value) : value
|
311
|
+
value = marshal ? Marshal.dump(value) : value
|
312
312
|
begin
|
313
313
|
check_return_code(
|
314
314
|
Lib.memcached_set(@struct, key, value, ttl, flags),
|
@@ -325,7 +325,7 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
|
|
325
325
|
|
326
326
|
# Add a key/value pair. Raises <b>Memcached::NotStored</b> if the key already exists on the server. The parameters are the same as <tt>set</tt>.
|
327
327
|
def add(key, value, ttl=@default_ttl, marshal=true, flags=FLAGS)
|
328
|
-
value = marshal ? Marshal.dump(value) : value
|
328
|
+
value = marshal ? Marshal.dump(value) : value
|
329
329
|
begin
|
330
330
|
check_return_code(
|
331
331
|
Lib.memcached_add(@struct, key, value, ttl, flags),
|
@@ -374,7 +374,7 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
|
|
374
374
|
|
375
375
|
# Replace a key/value pair. Raises <b>Memcached::NotFound</b> if the key does not exist on the server. The parameters are the same as <tt>set</tt>.
|
376
376
|
def replace(key, value, ttl=@default_ttl, marshal=true, flags=FLAGS)
|
377
|
-
value = marshal ? Marshal.dump(value) : value
|
377
|
+
value = marshal ? Marshal.dump(value) : value
|
378
378
|
begin
|
379
379
|
check_return_code(
|
380
380
|
Lib.memcached_replace(@struct, key, value, ttl, flags),
|
@@ -504,14 +504,14 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
|
|
504
504
|
check_return_code(ret, keys)
|
505
505
|
|
506
506
|
hash = {}
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
if ret != Lib::MEMCACHED_NOTFOUND
|
511
|
-
check_return_code(ret, key)
|
512
|
-
# Assign the value
|
507
|
+
value, key, flags, ret = Lib.memcached_fetch_rvalue(@struct)
|
508
|
+
while ret != 21 do # Lib::MEMCACHED_END
|
509
|
+
if ret == 0 # Lib::MEMCACHED_SUCCESS
|
513
510
|
hash[key] = (marshal ? Marshal.load(value) : value)
|
511
|
+
elsif ret != 16 # Lib::MEMCACHED_NOTFOUND
|
512
|
+
check_return_code(ret, key)
|
514
513
|
end
|
514
|
+
value, key, flags, ret = Lib.memcached_fetch_rvalue(@struct)
|
515
515
|
end
|
516
516
|
hash
|
517
517
|
else
|
@@ -591,28 +591,34 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
|
|
591
591
|
|
592
592
|
# 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.
|
593
593
|
def check_return_code(ret, key = nil) #:doc:
|
594
|
-
if ret == 0 #
|
595
|
-
elsif ret ==
|
596
|
-
elsif ret ==
|
597
|
-
raise @not_found
|
598
|
-
elsif ret ==
|
599
|
-
raise @not_stored
|
594
|
+
if ret == 0 # Lib::MEMCACHED_SUCCESS
|
595
|
+
elsif ret == 32 # Lib::MEMCACHED_BUFFERED
|
596
|
+
elsif ret == 16
|
597
|
+
raise @not_found # Lib::MEMCACHED_NOTFOUND
|
598
|
+
elsif ret == 14
|
599
|
+
raise @not_stored # Lib::MEMCACHED_NOTSTORED
|
600
600
|
else
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
601
|
+
reraise(key, ret)
|
602
|
+
end
|
603
|
+
rescue TypeError
|
604
|
+
reraise(key, ret)
|
605
|
+
end
|
606
|
+
|
607
|
+
def reraise(key, ret)
|
608
|
+
message = "Key #{inspect_keys(key, (detect_failure if ret == Lib::MEMCACHED_SERVER_MARKED_DEAD)).inspect}"
|
609
|
+
if key.is_a?(String)
|
610
|
+
if ret == Lib::MEMCACHED_ERRNO
|
611
|
+
if (server = Lib.memcached_server_by_key(@struct, key)).is_a?(Array)
|
612
|
+
errno = server.first.cached_errno
|
613
|
+
message = "Errno #{errno}: #{ERRNO_HASH[errno].inspect}. #{message}"
|
614
|
+
end
|
615
|
+
elsif ret == Lib::MEMCACHED_SERVER_ERROR
|
616
|
+
if (server = Lib.memcached_server_by_key(@struct, key)).is_a?(Array)
|
617
|
+
message = "\"#{server.first.cached_server_error}\". #{message}."
|
612
618
|
end
|
613
619
|
end
|
614
|
-
raise EXCEPTIONS[ret], message
|
615
620
|
end
|
621
|
+
raise EXCEPTIONS[ret], message
|
616
622
|
end
|
617
623
|
|
618
624
|
# Turn an array of keys into a hash of keys to servers.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
6
|
+
<string>English</string>
|
7
|
+
<key>CFBundleIdentifier</key>
|
8
|
+
<string>com.apple.xcode.dsym.rlibmemcached.bundle</string>
|
9
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
10
|
+
<string>6.0</string>
|
11
|
+
<key>CFBundlePackageType</key>
|
12
|
+
<string>dSYM</string>
|
13
|
+
<key>CFBundleSignature</key>
|
14
|
+
<string>????</string>
|
15
|
+
<key>CFBundleShortVersionString</key>
|
16
|
+
<string>1.0</string>
|
17
|
+
<key>CFBundleVersion</key>
|
18
|
+
<string>1</string>
|
19
|
+
</dict>
|
20
|
+
</plist>
|
data/memcached.gemspec
CHANGED
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{memcached}
|
5
|
-
s.version = "1.1"
|
5
|
+
s.version = "1.1.1"
|
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{2011-02-
|
10
|
+
s.date = %q{2011-02-23}
|
11
11
|
s.description = %q{An interface to the libmemcached C client.}
|
12
12
|
s.email = %q{}
|
13
13
|
s.extensions = ["ext/extconf.rb"]
|
14
14
|
s.extra_rdoc_files = ["BENCHMARKS", "CHANGELOG", "LICENSE", "README", "TODO", "lib/memcached.rb", "lib/memcached/behaviors.rb", "lib/memcached/exceptions.rb", "lib/memcached/experimental.rb", "lib/memcached/memcached.rb", "lib/memcached/rails.rb"]
|
15
|
-
s.files = ["BENCHMARKS", "CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "TODO", "ext/extconf-make.rb", "ext/extconf.rb", "ext/libmemcached-0.32.tar.gz", "ext/libmemcached-2.patch", "ext/libmemcached-3.patch", "ext/libmemcached-4.patch", "ext/libmemcached-5.patch", "ext/libmemcached-6.patch", "ext/libmemcached.patch", "ext/rlibmemcached.i", "ext/rlibmemcached_wrap.c", "ext/sasl.patch", "lib/memcached.rb", "lib/memcached/auth.rb", "lib/memcached/behaviors.rb", "lib/memcached/exceptions.rb", "lib/memcached/experimental.rb", "lib/memcached/memcached.rb", "lib/memcached/rails.rb", "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_experimental_test.rb", "test/unit/memcached_test.rb", "test/unit/rails_test.rb", "memcached.gemspec"]
|
16
|
-
s.homepage = %q{http://
|
15
|
+
s.files = ["BENCHMARKS", "CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "TODO", "ext/extconf-make.rb", "ext/extconf.rb", "ext/libmemcached-0.32.tar.gz", "ext/libmemcached-2.patch", "ext/libmemcached-3.patch", "ext/libmemcached-4.patch", "ext/libmemcached-5.patch", "ext/libmemcached-6.patch", "ext/libmemcached.patch", "ext/rlibmemcached.i", "ext/rlibmemcached_wrap.c", "ext/sasl.patch", "lib/memcached.rb", "lib/memcached/auth.rb", "lib/memcached/behaviors.rb", "lib/memcached/exceptions.rb", "lib/memcached/experimental.rb", "lib/memcached/memcached.rb", "lib/memcached/rails.rb", "lib/rlibmemcached.bundle.dSYM/Contents/Info.plist", "test/profile/benchmark.rb", "test/profile/c_profiler.rb", "test/profile/exercise.rb", "test/profile/rb_profiler.rb", "test/profile/valgrind.rb", "test/setup.rb", "test/teardown.rb", "test/test_helper.rb", "test/unit/binding_test.rb", "test/unit/memcached_experimental_test.rb", "test/unit/memcached_test.rb", "test/unit/rails_test.rb", "memcached.gemspec"]
|
16
|
+
s.homepage = %q{http://fauna.github.com/fauna/memcached/}
|
17
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Memcached", "--main", "README"]
|
18
18
|
s.require_paths = ["lib", "ext"]
|
19
19
|
s.rubyforge_project = %q{fauna}
|
data/test/profile/benchmark.rb
CHANGED
@@ -120,8 +120,12 @@ class Bench
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def benchmark_clients(test_name, populate_keys = true)
|
123
|
+
return if ENV["TEST"] and !test_name.include?(ENV["TEST"])
|
124
|
+
|
123
125
|
@clients.keys.sort.each do |client_name|
|
126
|
+
next if ENV["CLIENT"] and !client_name.include?(ENV["CLIENT"])
|
124
127
|
next if client_name == "stash" and test_name == "set-large" # Don't let stash break the world
|
128
|
+
|
125
129
|
client = @clients[client_name]
|
126
130
|
begin
|
127
131
|
if populate_keys
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/../setup"
|
2
|
+
|
3
|
+
$LOAD_PATH << "#{File.dirname(__FILE__)}/../../lib/"
|
4
|
+
require 'memcached'
|
5
|
+
|
6
|
+
profile = "/tmp/memcached_#{Memcached::VERSION}_c"
|
7
|
+
|
8
|
+
system("env CPUPROFILE_FREQUENCY=500 CPUPROFILE=#{profile}.out DYLD_INSERT_LIBRARIES=/opt/local/lib/libprofiler.dylib ruby -r#{File.dirname(__FILE__)}/exercise -e \"Worker.new('mixed', 200000).work\"")
|
9
|
+
|
10
|
+
ruby = `which ruby`.chomp
|
11
|
+
|
12
|
+
system("pprof --nodefraction=0.0000001 --text #{ruby} #{profile}.out")
|
13
|
+
system("pprof --nodefraction=0.0000001 --pdf #{ruby} #{profile}.out > #{profile}.pdf")
|
14
|
+
system("open #{profile}.pdf")
|
@@ -0,0 +1,150 @@
|
|
1
|
+
|
2
|
+
require "#{File.dirname(__FILE__)}/../setup"
|
3
|
+
|
4
|
+
$LOAD_PATH << "#{File.dirname(__FILE__)}/../../lib/"
|
5
|
+
require 'memcached'
|
6
|
+
require 'rubygems'
|
7
|
+
require 'ostruct'
|
8
|
+
|
9
|
+
GC.copy_on_write_friendly = true if GC.respond_to?("copy_on_write_friendly=")
|
10
|
+
|
11
|
+
Struct
|
12
|
+
|
13
|
+
class Worker
|
14
|
+
def initialize(method_name, iterations, with_memory = 'false')
|
15
|
+
@method = method_name || 'mixed'
|
16
|
+
@i = (iterations || 10000).to_i
|
17
|
+
@with_memory = with_memory
|
18
|
+
|
19
|
+
puts "*** Running #{@method.inspect} test for #{@i} loops. ***"
|
20
|
+
|
21
|
+
@key1 = "key1--------------------------------"
|
22
|
+
@key2 = "key2--------------------------------"
|
23
|
+
@key3 = "key3--------------------------------"
|
24
|
+
|
25
|
+
@value = OpenStruct.new(
|
26
|
+
:a => 1, :b => 2, "array" => [1, 2, 3], "hash" => {:badger => 1}
|
27
|
+
)
|
28
|
+
@marshalled = Marshal.dump(@value)
|
29
|
+
|
30
|
+
@opts = [
|
31
|
+
['localhost:43042', 'localhost:43043', 'localhost:43044'],
|
32
|
+
{
|
33
|
+
:buffer_requests => true,
|
34
|
+
:no_block => true,
|
35
|
+
:noreply => true,
|
36
|
+
:namespace => "namespace"
|
37
|
+
}
|
38
|
+
]
|
39
|
+
@cache = Memcached::Rails.new(*@opts)
|
40
|
+
|
41
|
+
@cache.set @key1, @value
|
42
|
+
end
|
43
|
+
|
44
|
+
def work
|
45
|
+
case @method
|
46
|
+
when "set"
|
47
|
+
@i.times do
|
48
|
+
@cache.set @key1, @value
|
49
|
+
end
|
50
|
+
when "get"
|
51
|
+
@i.times do
|
52
|
+
@cache.get @key1
|
53
|
+
end
|
54
|
+
when "delete"
|
55
|
+
@i.times do
|
56
|
+
@cache.set @key1, @value
|
57
|
+
@cache.delete @key1
|
58
|
+
end
|
59
|
+
when "delete-miss"
|
60
|
+
@i.times do
|
61
|
+
@cache.delete @key1
|
62
|
+
end
|
63
|
+
when "get-miss"
|
64
|
+
@i.times do
|
65
|
+
@cache.get @key2
|
66
|
+
end
|
67
|
+
when "get-increasing"
|
68
|
+
one_k = "x"*1024
|
69
|
+
@i.times do |i|
|
70
|
+
@cache.set @key1, one_k*(i+1), 0, false
|
71
|
+
@cache.get @key1, false
|
72
|
+
end
|
73
|
+
when "get-miss-increasing"
|
74
|
+
@i.times do |i|
|
75
|
+
@cache.delete @key2
|
76
|
+
@cache.get @key2
|
77
|
+
end
|
78
|
+
when "add"
|
79
|
+
@i.times do
|
80
|
+
@cache.delete @key1
|
81
|
+
@cache.add @key1, @value
|
82
|
+
end
|
83
|
+
when "add-present"
|
84
|
+
@cache.set @key1, @value
|
85
|
+
@i.times do
|
86
|
+
@cache.add @key1, @value
|
87
|
+
end
|
88
|
+
when "mixed"
|
89
|
+
@i.times do
|
90
|
+
@cache.set @key1, @value
|
91
|
+
@cache.set @key2, @value
|
92
|
+
@cache.get @key1
|
93
|
+
@cache.get @key3
|
94
|
+
@cache.get [@key1, @key2, @key3]
|
95
|
+
@cache.prepend @key1, @marshalled
|
96
|
+
@cache.prepend @key2, @marshalled
|
97
|
+
@cache.delete @key1
|
98
|
+
@cache.delete @key2
|
99
|
+
end
|
100
|
+
when "stats"
|
101
|
+
@i.times do
|
102
|
+
@cache.stats
|
103
|
+
end
|
104
|
+
when "multiget"
|
105
|
+
@i.times do
|
106
|
+
@cache.get([@key1, @key2])
|
107
|
+
end
|
108
|
+
when "clone"
|
109
|
+
@i.times do
|
110
|
+
cache = @cache.clone
|
111
|
+
end
|
112
|
+
when "reset"
|
113
|
+
@i.times do
|
114
|
+
@cache.reset
|
115
|
+
end
|
116
|
+
when "servers"
|
117
|
+
@i.times do
|
118
|
+
@cache.servers
|
119
|
+
end
|
120
|
+
when "server_by_key"
|
121
|
+
@i.times do
|
122
|
+
@cache.server_by_key(@key1)
|
123
|
+
end
|
124
|
+
else
|
125
|
+
raise "No such method"
|
126
|
+
end
|
127
|
+
|
128
|
+
if @with_memory == "true"
|
129
|
+
puts "*** Garbage collect. ***"
|
130
|
+
10.times do
|
131
|
+
GC.start
|
132
|
+
sleep 0.1
|
133
|
+
end
|
134
|
+
|
135
|
+
sts, server_sts, clients = 0, 0, 0
|
136
|
+
ObjectSpace.each_object(Memcached) { clients += 1 }
|
137
|
+
ObjectSpace.each_object(Rlibmemcached::MemcachedSt) { sts += 1 }
|
138
|
+
ObjectSpace.each_object(Rlibmemcached::MemcachedServerSt) { server_sts += 1 }
|
139
|
+
puts "*** Structs: #{sts} ***"
|
140
|
+
puts "*** Server structs: #{server_sts} ***"
|
141
|
+
puts "*** Clients: #{clients} ***"
|
142
|
+
|
143
|
+
begin;
|
144
|
+
require 'memory'
|
145
|
+
Process.memory.each { |key, value| puts "#{key}: #{value/1024.0}M" }
|
146
|
+
rescue LoadError
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
require "#{File.dirname(__FILE__)}/../setup"
|
3
|
+
|
4
|
+
$LOAD_PATH << "#{File.dirname(__FILE__)}/../../lib/"
|
5
|
+
|
6
|
+
ENV['CPUPROFILE_FREQUENCY'] = '500'
|
7
|
+
require 'memcached'
|
8
|
+
require 'rubygems'
|
9
|
+
require 'perftools'
|
10
|
+
require "#{HERE}/profile/exercise"
|
11
|
+
|
12
|
+
profile = "/tmp/memcached_#{Memcached::VERSION}_rb"
|
13
|
+
worker = Worker.new('mixed', 200000)
|
14
|
+
|
15
|
+
PerfTools::CpuProfiler.start("#{profile}.out") do
|
16
|
+
worker.work
|
17
|
+
end
|
18
|
+
|
19
|
+
system("pprof.rb --nodefraction=0.0000001 --text #{profile}.out")
|
20
|
+
system("pprof.rb --nodefraction=0.0000001 --edgefraction=0.0000001 --pdf #{profile}.out > #{profile}.pdf")
|
21
|
+
system("open #{profile}.pdf")
|
data/test/profile/valgrind.rb
CHANGED
@@ -1,149 +1,3 @@
|
|
1
|
-
|
2
1
|
require "#{File.dirname(__FILE__)}/../setup"
|
3
2
|
|
4
|
-
|
5
|
-
require 'memcached'
|
6
|
-
require 'rubygems'
|
7
|
-
|
8
|
-
GC.copy_on_write_friendly = true if GC.respond_to?("copy_on_write_friendly=")
|
9
|
-
|
10
|
-
class Worker
|
11
|
-
def initialize(method_name, iterations)
|
12
|
-
@method = method_name || 'mixed'
|
13
|
-
@i = (iterations || 10000).to_i
|
14
|
-
|
15
|
-
puts "*** Running #{@method.inspect} test for #{@i} loops. ***"
|
16
|
-
|
17
|
-
@key1 = "key1-"*8
|
18
|
-
@key2 = "key2-"*8
|
19
|
-
|
20
|
-
@value = []
|
21
|
-
@marshalled = Marshal.dump(@value)
|
22
|
-
|
23
|
-
@opts = [
|
24
|
-
["#{UNIX_SOCKET_NAME}0", "#{UNIX_SOCKET_NAME}1"],
|
25
|
-
{
|
26
|
-
:buffer_requests => false,
|
27
|
-
:no_block => false,
|
28
|
-
:namespace => "namespace"
|
29
|
-
}
|
30
|
-
]
|
31
|
-
@cache = Memcached.new(*@opts)
|
32
|
-
|
33
|
-
@cache.set @key1, @value
|
34
|
-
end
|
35
|
-
|
36
|
-
def work
|
37
|
-
case @method
|
38
|
-
when "set"
|
39
|
-
@i.times do
|
40
|
-
@cache.set @key1, @value
|
41
|
-
end
|
42
|
-
when "get"
|
43
|
-
@i.times do
|
44
|
-
@cache.get @key1
|
45
|
-
end
|
46
|
-
when "delete"
|
47
|
-
@i.times do
|
48
|
-
@cache.set @key1, @value
|
49
|
-
@cache.delete @key1
|
50
|
-
end
|
51
|
-
when "delete-miss"
|
52
|
-
@i.times do
|
53
|
-
@cache.delete @key1
|
54
|
-
end
|
55
|
-
when "get-miss"
|
56
|
-
@i.times do
|
57
|
-
begin
|
58
|
-
@cache.get @key2
|
59
|
-
rescue Memcached::NotFound
|
60
|
-
end
|
61
|
-
end
|
62
|
-
when "get-increasing"
|
63
|
-
one_k = "x"*1024
|
64
|
-
@i.times do |i|
|
65
|
-
@cache.set @key1, one_k*(i+1), 0, false
|
66
|
-
@cache.get @key1, false
|
67
|
-
end
|
68
|
-
when "get-miss-increasing"
|
69
|
-
@i.times do |i|
|
70
|
-
@cache.delete @key2 rescue nil
|
71
|
-
begin
|
72
|
-
@cache.get @key2
|
73
|
-
rescue Memcached::NotFound
|
74
|
-
end
|
75
|
-
end
|
76
|
-
when "add"
|
77
|
-
@i.times do
|
78
|
-
begin
|
79
|
-
@cache.delete @key1
|
80
|
-
rescue
|
81
|
-
end
|
82
|
-
@cache.add @key1, @value
|
83
|
-
end
|
84
|
-
when "add-present"
|
85
|
-
@cache.set @key1, @value
|
86
|
-
@i.times do
|
87
|
-
begin
|
88
|
-
@cache.add @key1, @value
|
89
|
-
rescue Memcached::NotStored
|
90
|
-
end
|
91
|
-
end
|
92
|
-
when "mixed"
|
93
|
-
@i.times do
|
94
|
-
@cache.set @key1, @value
|
95
|
-
@cache.get @key1
|
96
|
-
end
|
97
|
-
when "stats"
|
98
|
-
@i.times do
|
99
|
-
@cache.stats
|
100
|
-
end
|
101
|
-
when "multiget"
|
102
|
-
@i.times do
|
103
|
-
@cache.get([@key1, @key2])
|
104
|
-
end
|
105
|
-
when "clone"
|
106
|
-
@i.times do
|
107
|
-
cache = @cache.clone
|
108
|
-
end
|
109
|
-
when "reset"
|
110
|
-
@i.times do
|
111
|
-
@cache.reset
|
112
|
-
end
|
113
|
-
when "servers"
|
114
|
-
@i.times do
|
115
|
-
@cache.servers
|
116
|
-
end
|
117
|
-
when "server_by_key"
|
118
|
-
@i.times do
|
119
|
-
@cache.server_by_key(@key1)
|
120
|
-
end
|
121
|
-
else
|
122
|
-
raise "No such method"
|
123
|
-
end
|
124
|
-
|
125
|
-
puts "*** Garbage collect. ***"
|
126
|
-
10.times do
|
127
|
-
GC.start
|
128
|
-
sleep 0.1
|
129
|
-
end
|
130
|
-
|
131
|
-
sts, server_sts, clients = 0, 0, 0
|
132
|
-
ObjectSpace.each_object(Memcached) { clients += 1 }
|
133
|
-
ObjectSpace.each_object(Rlibmemcached::MemcachedSt) { sts += 1 }
|
134
|
-
ObjectSpace.each_object(Rlibmemcached::MemcachedServerSt) { server_sts += 1 }
|
135
|
-
puts "*** Structs: #{sts} ***"
|
136
|
-
puts "*** Server structs: #{server_sts} ***"
|
137
|
-
puts "*** Clients: #{clients} ***"
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
Worker.new(ENV['METHOD'], ENV['LOOPS']).work
|
142
|
-
|
143
|
-
begin
|
144
|
-
require 'memory'
|
145
|
-
Process.memory.each do |key, value|
|
146
|
-
puts "#{key}: #{value/1024.0}M"
|
147
|
-
end
|
148
|
-
rescue LoadError
|
149
|
-
end
|
3
|
+
exec("valgrind --tool=memcheck --leak-check=full --show-reachable=no --num-callers=15 --track-fds=yes --workaround-gcc296-bugs=yes --max-stackframe=7304328 --dsymutil=yes --track-origins=yes ruby -r#{File.dirname(__FILE__)}/exercise.rb -e \"Worker.new('mixed', 10000, 'true').work\"")
|
data/test/unit/memcached_test.rb
CHANGED
@@ -177,9 +177,8 @@ class MemcachedTest < Test::Unit::TestCase
|
|
177
177
|
end
|
178
178
|
|
179
179
|
def test_initialize_with_backtraces
|
180
|
-
cache = Memcached.new @servers,
|
181
|
-
|
182
|
-
cache.delete key rescue
|
180
|
+
cache = Memcached.new @servers, :show_backtraces => true
|
181
|
+
cache.delete key rescue nil
|
183
182
|
begin
|
184
183
|
cache.get key
|
185
184
|
rescue Memcached::NotFound => e
|
@@ -404,9 +403,21 @@ class MemcachedTest < Test::Unit::TestCase
|
|
404
403
|
assert_equal @marshalled_value, result
|
405
404
|
end
|
406
405
|
|
406
|
+
def test_set_unmarshalled_and_get_unmarshalled
|
407
|
+
@cache.set key, @marshalled_value, 0, false
|
408
|
+
result = @cache.get key, false
|
409
|
+
assert_equal @marshalled_value, result
|
410
|
+
end
|
411
|
+
|
412
|
+
def test_set_unmarshalled_error
|
413
|
+
assert_raises(TypeError) do
|
414
|
+
@cache.set key, @value, 0, false
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
407
418
|
def test_get_multi_unmarshalled
|
408
|
-
@cache.set "#{key}_1", 1, 0, false
|
409
|
-
@cache.set "#{key}_2", 2, 0, false
|
419
|
+
@cache.set "#{key}_1", "1", 0, false
|
420
|
+
@cache.set "#{key}_2", "2", 0, false
|
410
421
|
assert_equal(
|
411
422
|
{"#{key}_1" => "1", "#{key}_2" => "2"},
|
412
423
|
@cache.get(["#{key}_1", "#{key}_2"], false)
|
@@ -415,7 +426,7 @@ class MemcachedTest < Test::Unit::TestCase
|
|
415
426
|
|
416
427
|
def test_get_multi_mixed_marshalling
|
417
428
|
@cache.set "#{key}_1", 1
|
418
|
-
@cache.set "#{key}_2", 2, 0, false
|
429
|
+
@cache.set "#{key}_2", "2", 0, false
|
419
430
|
assert_nothing_raised do
|
420
431
|
@cache.get(["#{key}_1", "#{key}_2"], false)
|
421
432
|
end
|
@@ -429,12 +440,15 @@ class MemcachedTest < Test::Unit::TestCase
|
|
429
440
|
cache.flush
|
430
441
|
20.times { |i| cache.set "#{key}#{i}", @value }
|
431
442
|
|
432
|
-
cache, hits = Memcached.new(@servers.first),
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
443
|
+
cache, hits = Memcached.new(@servers.first), 4
|
444
|
+
while hits == 4 do
|
445
|
+
hits = 0
|
446
|
+
20.times do |i|
|
447
|
+
begin
|
448
|
+
cache.get "#{key}#{i}"
|
449
|
+
hits += 1
|
450
|
+
rescue Memcached::NotFound
|
451
|
+
end
|
438
452
|
end
|
439
453
|
end
|
440
454
|
|
@@ -563,12 +577,12 @@ class MemcachedTest < Test::Unit::TestCase
|
|
563
577
|
# Increment and decrement
|
564
578
|
|
565
579
|
def test_increment
|
566
|
-
@cache.set key, 10, 0, false
|
580
|
+
@cache.set key, "10", 0, false
|
567
581
|
assert_equal 11, @cache.increment(key)
|
568
582
|
end
|
569
583
|
|
570
584
|
def test_increment_offset
|
571
|
-
@cache.set key, 10, 0, false
|
585
|
+
@cache.set key, "10", 0, false
|
572
586
|
assert_equal 15, @cache.increment(key, 5)
|
573
587
|
end
|
574
588
|
|
@@ -580,12 +594,12 @@ class MemcachedTest < Test::Unit::TestCase
|
|
580
594
|
end
|
581
595
|
|
582
596
|
def test_decrement
|
583
|
-
@cache.set key, 10, 0, false
|
597
|
+
@cache.set key, "10", 0, false
|
584
598
|
assert_equal 9, @cache.decrement(key)
|
585
599
|
end
|
586
600
|
|
587
601
|
def test_decrement_offset
|
588
|
-
@cache.set key, 10, 0, false
|
602
|
+
@cache.set key, "10", 0, false
|
589
603
|
assert_equal 5, @cache.decrement(key, 5)
|
590
604
|
end
|
591
605
|
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memcached
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
|
9
|
+
- 1
|
10
|
+
version: 1.1.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Evan Weaver
|
@@ -35,7 +36,7 @@ cert_chain:
|
|
35
36
|
yZ0=
|
36
37
|
-----END CERTIFICATE-----
|
37
38
|
|
38
|
-
date: 2011-02-
|
39
|
+
date: 2011-02-23 00:00:00 -08:00
|
39
40
|
default_executable:
|
40
41
|
dependencies: []
|
41
42
|
|
@@ -84,8 +85,11 @@ files:
|
|
84
85
|
- lib/memcached/experimental.rb
|
85
86
|
- lib/memcached/memcached.rb
|
86
87
|
- lib/memcached/rails.rb
|
88
|
+
- lib/rlibmemcached.bundle.dSYM/Contents/Info.plist
|
87
89
|
- test/profile/benchmark.rb
|
88
|
-
- test/profile/
|
90
|
+
- test/profile/c_profiler.rb
|
91
|
+
- test/profile/exercise.rb
|
92
|
+
- test/profile/rb_profiler.rb
|
89
93
|
- test/profile/valgrind.rb
|
90
94
|
- test/setup.rb
|
91
95
|
- test/teardown.rb
|
@@ -96,7 +100,7 @@ files:
|
|
96
100
|
- test/unit/rails_test.rb
|
97
101
|
- memcached.gemspec
|
98
102
|
has_rdoc: true
|
99
|
-
homepage: http://
|
103
|
+
homepage: http://fauna.github.com/fauna/memcached/
|
100
104
|
licenses: []
|
101
105
|
|
102
106
|
post_install_message:
|
metadata.gz.sig
CHANGED
Binary file
|
data/test/profile/profile.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
require "#{File.dirname(__FILE__)}/../setup"
|
3
|
-
|
4
|
-
$LOAD_PATH << "#{File.dirname(__FILE__)}/../../lib/"
|
5
|
-
require 'rubygems'
|
6
|
-
require 'memcached'
|
7
|
-
require 'ruby-prof'
|
8
|
-
|
9
|
-
result = RubyProf.profile do
|
10
|
-
load "#{HERE}/profile/valgrind.rb"
|
11
|
-
end
|
12
|
-
|
13
|
-
printer = RubyProf::GraphPrinter.new(result)
|
14
|
-
printer.print(STDOUT, 0)
|