memcached 0.20.1 → 1
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 +114 -107
- data/CHANGELOG +2 -0
- data/README +3 -3
- data/Rakefile +1 -1
- data/ext/rlibmemcached.i +3 -7
- data/ext/rlibmemcached_wrap.c +3 -7
- data/memcached.gemspec +3 -3
- data/test/profile/benchmark.rb +49 -38
- data/test/unit/memcached_test.rb +7 -3
- data/test/unit/rails_test.rb +9 -4
- metadata +3 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/BENCHMARKS
CHANGED
@@ -9,112 +9,119 @@ 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:
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
Loaded
|
16
|
-
|
12
|
+
Darwin amber.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT
|
13
|
+
2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
|
14
|
+
Ruby 1.9.2p0
|
15
|
+
Loaded memcached 0.20.1
|
16
|
+
Loaded remix-stash 1.1.3
|
17
|
+
Loaded memcache-client 1.8.5
|
18
|
+
Loaded dalli 0.9.2
|
19
|
+
Loops is 20000
|
17
20
|
Stack depth is 0
|
18
|
-
Small value size is:
|
19
|
-
Large value size is:
|
20
|
-
|
21
|
+
Small value size is: 19 bytes
|
22
|
+
Large value size is: 4189 bytes
|
23
|
+
No matching processes belonging to you were found
|
21
24
|
user system total real
|
22
|
-
set:
|
23
|
-
set:libm:
|
24
|
-
set:libm:
|
25
|
-
set:libm:
|
26
|
-
set:libm:
|
27
|
-
set:
|
28
|
-
set:
|
29
|
-
|
30
|
-
|
31
|
-
get:
|
32
|
-
get:libm:
|
33
|
-
get:libm:
|
34
|
-
get:
|
35
|
-
get:
|
36
|
-
get
|
37
|
-
get
|
38
|
-
get
|
39
|
-
|
40
|
-
get-multi:
|
41
|
-
get-multi:
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
append:
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
get-
|
75
|
-
get-
|
76
|
-
get-
|
77
|
-
get-
|
78
|
-
get-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
set-
|
97
|
-
set-
|
98
|
-
set-
|
99
|
-
set-
|
100
|
-
set-
|
101
|
-
set-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
get-
|
106
|
-
get-
|
107
|
-
get-
|
108
|
-
get-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
hash:
|
115
|
-
hash:
|
116
|
-
hash:
|
117
|
-
hash:
|
118
|
-
hash:
|
119
|
-
|
120
|
-
|
25
|
+
set: dalli:bin 4.820000 1.510000 6.330000 ( 7.225315)
|
26
|
+
set: libm:ascii 0.570000 0.980000 1.550000 ( 4.003960)
|
27
|
+
set: libm:ascii:pipelined 0.170000 0.020000 0.190000 ( 0.203469)
|
28
|
+
set: libm:ascii:udp 0.450000 0.570000 1.020000 ( 2.077743)
|
29
|
+
set: libm:bin 0.480000 0.990000 1.470000 ( 3.692485)
|
30
|
+
set: libm:bin:buffered 0.140000 0.120000 0.260000 ( 0.870617)
|
31
|
+
set: mclient:ascii 7.300000 3.290000 10.590000 ( 11.325935)
|
32
|
+
set: stash:bin 2.600000 1.170000 3.770000 ( 6.621495)
|
33
|
+
|
34
|
+
get: dalli:bin 5.540000 1.660000 7.200000 ( 7.762690)
|
35
|
+
get: libm:ascii 0.680000 1.040000 1.720000 ( 3.918273)
|
36
|
+
get: libm:ascii:pipelined 0.780000 1.270000 2.050000 ( 4.130800)
|
37
|
+
get: libm:ascii:udp 0.580000 0.570000 1.150000 ( 2.097873)
|
38
|
+
get: libm:bin 0.560000 1.000000 1.560000 ( 3.504147)
|
39
|
+
get: libm:bin:buffered 0.670000 1.330000 2.000000 ( 4.134638)
|
40
|
+
get: mclient:ascii 8.820000 3.440000 12.260000 ( 12.775693)
|
41
|
+
get: stash:bin 2.390000 1.310000 3.700000 ( 5.927902)
|
42
|
+
|
43
|
+
get-multi: dalli:bin 6.910000 2.790000 9.700000 ( 10.351834)
|
44
|
+
get-multi: libm:ascii 0.780000 0.640000 1.420000 ( 2.400928)
|
45
|
+
get-multi: libm:ascii:pipelined 0.780000 0.650000 1.430000 ( 2.398865)
|
46
|
+
get-multi: libm:ascii:udp 0.730000 0.480000 1.210000 ( 1.667487)
|
47
|
+
get-multi: libm:bin 0.790000 0.940000 1.730000 ( 3.077329)
|
48
|
+
get-multi: libm:bin:buffered 0.800000 0.980000 1.780000 ( 3.120033)
|
49
|
+
|
50
|
+
append: dalli:bin 5.340000 1.820000 7.160000 ( 9.463384)
|
51
|
+
append: libm:ascii 0.610000 1.060000 1.670000 ( 6.177618)
|
52
|
+
append: libm:ascii:pipelined 0.190000 0.040000 0.230000 ( 10.719099)
|
53
|
+
append: libm:ascii:udp 0.500000 0.590000 1.090000 ( 4.877804)
|
54
|
+
append: libm:bin 0.530000 1.030000 1.560000 ( 12.678462)
|
55
|
+
append: libm:bin:buffered 0.800000 1.480000 2.280000 ( 20.612821)
|
56
|
+
append: mclient:ascii 7.680000 3.500000 11.180000 ( 17.252513)
|
57
|
+
|
58
|
+
prepend: dalli:bin 7.020000 1.990000 9.010000 ( 13.790809)
|
59
|
+
prepend: libm:ascii 0.860000 1.160000 2.020000 ( 22.172399)
|
60
|
+
prepend: libm:ascii:pipelined 0.180000 0.020000 0.200000 ( 0.228367)
|
61
|
+
prepend: libm:ascii:udp 0.540000 0.630000 1.170000 ( 14.770980)
|
62
|
+
prepend: libm:bin 1.150000 1.050000 2.200000 ( 5.341857)
|
63
|
+
prepend: libm:bin:buffered 1.250000 1.390000 2.640000 ( 5.621586)
|
64
|
+
prepend: mclient:ascii 7.650000 3.420000 11.070000 ( 11.717946)
|
65
|
+
|
66
|
+
delete: dalli:bin 5.320000 1.760000 7.080000 ( 7.442455)
|
67
|
+
delete: libm:ascii 1.150000 1.050000 2.200000 ( 4.588383)
|
68
|
+
delete: libm:ascii:pipelined 0.290000 0.370000 0.660000 ( 0.773548)
|
69
|
+
delete: libm:ascii:udp 1.060000 0.660000 1.720000 ( 3.389179)
|
70
|
+
delete: libm:bin 1.080000 1.040000 2.120000 ( 4.461896)
|
71
|
+
delete: libm:bin:buffered 0.230000 0.350000 0.580000 ( 1.114071)
|
72
|
+
delete: mclient:ascii 7.640000 3.380000 11.020000 ( 11.271308)
|
73
|
+
|
74
|
+
get-missing: dalli:bin 5.410000 1.760000 7.170000 ( 7.756717)
|
75
|
+
get-missing: libm:ascii 1.190000 1.000000 2.190000 ( 4.992572)
|
76
|
+
get-missing: libm:ascii:pipelined 1.290000 1.410000 2.700000 ( 4.775207)
|
77
|
+
get-missing: libm:ascii:udp 1.090000 0.660000 1.750000 ( 3.354907)
|
78
|
+
get-missing: libm:bin 1.170000 1.060000 2.230000 ( 4.550311)
|
79
|
+
get-missing: libm:bin:buffered 1.270000 1.390000 2.660000 ( 4.834454)
|
80
|
+
get-missing: mclient:ascii 7.570000 3.390000 10.960000 ( 11.470425)
|
81
|
+
get-missing: stash:bin 2.350000 1.340000 3.690000 ( 6.073585)
|
82
|
+
|
83
|
+
append-missing: dalli:bin 7.740000 1.980000 9.720000 ( 10.168658)
|
84
|
+
append-missing: libm:ascii 1.240000 1.070000 2.310000 ( 5.397586)
|
85
|
+
append-missing: libm:ascii:pipelined 0.190000 0.020000 0.210000 ( 0.227031)
|
86
|
+
append-missing: libm:ascii:udp 1.130000 0.680000 1.810000 ( 3.926319)
|
87
|
+
append-missing: libm:bin 1.140000 1.060000 2.200000 ( 4.798300)
|
88
|
+
append-missing: libm:bin:buffered 1.250000 1.410000 2.660000 ( 5.091978)
|
89
|
+
append-missing: mclient:ascii 7.830000 3.440000 11.270000 ( 11.654683)
|
90
|
+
|
91
|
+
prepend-missing: dalli:bin 7.750000 1.990000 9.740000 ( 10.179379)
|
92
|
+
prepend-missing: libm:ascii 1.240000 1.070000 2.310000 ( 5.418788)
|
93
|
+
prepend-missing: libm:ascii:pipelined 0.180000 0.010000 0.190000 ( 0.201024)
|
94
|
+
prepend-missing: libm:ascii:udp 1.120000 0.680000 1.800000 ( 3.931292)
|
95
|
+
prepend-missing: libm:bin 1.150000 1.070000 2.220000 ( 4.820438)
|
96
|
+
prepend-missing: libm:bin:buffered 1.240000 1.410000 2.650000 ( 5.083105)
|
97
|
+
prepend-missing: mclient:ascii 7.850000 3.450000 11.300000 ( 11.663710)
|
98
|
+
|
99
|
+
set-large: dalli:bin 5.470000 1.700000 7.170000 ( 7.819158)
|
100
|
+
set-large: libm:ascii 0.620000 1.120000 1.740000 ( 4.489379)
|
101
|
+
set-large: libm:ascii:pipelined 0.330000 0.290000 0.620000 ( 1.235649)
|
102
|
+
set-large: libm:ascii:udp 0.500000 0.650000 1.150000 ( 3.026405)
|
103
|
+
set-large: libm:bin 0.510000 1.060000 1.570000 ( 4.105516)
|
104
|
+
set-large: libm:bin:buffered 0.300000 0.460000 0.760000 ( 1.590685)
|
105
|
+
set-large: mclient:ascii 8.170000 3.580000 11.750000 ( 12.304508)
|
106
|
+
set-large: stash:bin 3.820000 1.190000 5.010000 ( 7.826406)
|
107
|
+
|
108
|
+
get-large: dalli:bin 6.070000 1.980000 8.050000 ( 8.625461)
|
109
|
+
get-large: libm:ascii 0.920000 1.090000 2.010000 ( 4.725218)
|
110
|
+
get-large: libm:ascii:pipelined 1.010000 1.470000 2.480000 ( 5.123318)
|
111
|
+
get-large: libm:ascii:udp 0.840000 0.740000 1.580000 ( 2.479091)
|
112
|
+
get-large: libm:bin 0.810000 1.200000 2.010000 ( 4.404212)
|
113
|
+
get-large: libm:bin:buffered 0.890000 1.430000 2.320000 ( 4.991805)
|
114
|
+
get-large: mclient:ascii 10.270000 4.040000 14.310000 ( 14.881824)
|
115
|
+
get-large: stash:bin 2.480000 1.350000 3.830000 ( 6.041167)
|
116
|
+
|
117
|
+
hash:default 0.330000 0.000000 0.330000 ( 0.338913)
|
118
|
+
hash:md5 0.740000 0.000000 0.740000 ( 0.749003)
|
119
|
+
hash:crc 0.430000 0.010000 0.440000 ( 0.428859)
|
120
|
+
hash:fnv1_64 0.800000 0.000000 0.800000 ( 0.814617)
|
121
|
+
hash:fnv1a_64 0.290000 0.000000 0.290000 ( 0.289964)
|
122
|
+
hash:fnv1_32 0.270000 0.000000 0.270000 ( 0.273325)
|
123
|
+
hash:fnv1a_32 0.280000 0.010000 0.290000 ( 0.307831)
|
124
|
+
hash:hsieh 0.130000 0.000000 0.130000 ( 0.128252)
|
125
|
+
hash:murmur 0.210000 0.000000 0.210000 ( 0.212935)
|
126
|
+
hash:jenkins 0.250000 0.000000 0.250000 ( 0.257421)
|
127
|
+
hash:none 0.130000 0.000000 0.130000 ( 0.124726)
|
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -16,13 +16,13 @@ If you use this software, please {make a donation}[http://blog.evanweaver.com/do
|
|
16
16
|
* clean API
|
17
17
|
* robust access to all memcached features
|
18
18
|
* multiple hashing modes, including consistent hashing
|
19
|
-
* ludicrous speed, including optional
|
19
|
+
* ludicrous speed, including optional pipelined IO with no_reply
|
20
20
|
|
21
21
|
The <b>memcached</b> library wraps the pure-C libmemcached client via SWIG.
|
22
22
|
|
23
23
|
== Installation
|
24
24
|
|
25
|
-
You need Ruby 1.8.7 or Ruby 1.9.
|
25
|
+
You need Ruby 1.8.7 or Ruby 1.9.2. Other versions may work, but are not guaranteed. You also need the libsasl2-dev library, which should be provided through your system's package manager.
|
26
26
|
|
27
27
|
Install the gem:
|
28
28
|
sudo gem install memcached --no-rdoc --no-ri
|
@@ -97,7 +97,7 @@ There is a compatibility wrapper for legacy applications called Memcached::Rails
|
|
97
97
|
|
98
98
|
== Benchmarks
|
99
99
|
|
100
|
-
<b>memcached</b
|
100
|
+
<b>memcached</b>, correctly configured, is up to 60x faster than <b>memcache-client</b> or <b>dalli</b>. See BENCHMARKS[link:files/BENCHMARKS.html] for details.
|
101
101
|
|
102
102
|
== Reporting problems
|
103
103
|
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ Echoe.new("memcached") do |p|
|
|
6
6
|
p.summary = "An interface to the libmemcached C client."
|
7
7
|
p.url = "http://blog.evanweaver.com/files/doc/fauna/memcached/"
|
8
8
|
p.docs_host = "blog.evanweaver.com:~/www/bax/public/files/doc/"
|
9
|
-
p.rdoc_pattern = /README|TODO|LICENSE|CHANGELOG|BENCH|COMPAT|exceptions|behaviors|rails.rb|memcached.rb/
|
9
|
+
p.rdoc_pattern = /README|TODO|LICENSE|CHANGELOG|BENCH|COMPAT|exceptions|experimental.rb|behaviors|rails.rb|memcached.rb/
|
10
10
|
p.clean_pattern += ["ext/lib", "ext/include", "ext/share", "ext/libmemcached-?.??", "ext/bin", "ext/conftest.dSYM"]
|
11
11
|
end
|
12
12
|
|
data/ext/rlibmemcached.i
CHANGED
@@ -196,13 +196,9 @@ VALUE memcached_fetch_rvalue(memcached_st *ptr, char *key, size_t *key_length, u
|
|
196
196
|
VALUE result = rb_ary_new();
|
197
197
|
|
198
198
|
char *value = memcached_fetch(ptr, key, key_length, &value_length, flags, error);
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
VALUE ret = rb_str_new(value, value_length);
|
203
|
-
rb_ary_push(result, ret);
|
204
|
-
free(value);
|
205
|
-
}
|
199
|
+
VALUE ret = rb_str_new(value, value_length);
|
200
|
+
rb_ary_push(result, ret);
|
201
|
+
free(value);
|
206
202
|
return result;
|
207
203
|
};
|
208
204
|
%}
|
data/ext/rlibmemcached_wrap.c
CHANGED
@@ -2285,13 +2285,9 @@ VALUE memcached_fetch_rvalue(memcached_st *ptr, char *key, size_t *key_length, u
|
|
2285
2285
|
VALUE result = rb_ary_new();
|
2286
2286
|
|
2287
2287
|
char *value = memcached_fetch(ptr, key, key_length, &value_length, flags, error);
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
VALUE ret = rb_str_new(value, value_length);
|
2292
|
-
rb_ary_push(result, ret);
|
2293
|
-
free(value);
|
2294
|
-
}
|
2288
|
+
VALUE ret = rb_str_new(value, value_length);
|
2289
|
+
rb_ary_push(result, ret);
|
2290
|
+
free(value); // SWIG apparently handles when value is NULL
|
2295
2291
|
return result;
|
2296
2292
|
};
|
2297
2293
|
|
data/memcached.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{memcached}
|
5
|
-
s.version = "
|
5
|
+
s.version = "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{2010-08
|
10
|
+
s.date = %q{2010-09-08}
|
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
|
-
s.extra_rdoc_files = ["BENCHMARKS", "CHANGELOG", "LICENSE", "README", "TODO", "lib/memcached.rb", "lib/memcached/behaviors.rb", "lib/memcached/exceptions.rb", "lib/memcached/memcached.rb", "lib/memcached/rails.rb"]
|
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
15
|
s.files = ["BENCHMARKS", "CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "TODO", "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.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/integer.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
16
|
s.homepage = %q{http://blog.evanweaver.com/files/doc/fauna/memcached/}
|
17
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Memcached", "--main", "README"]
|
data/test/profile/benchmark.rb
CHANGED
@@ -13,9 +13,10 @@ puts `uname -a`
|
|
13
13
|
puts "Ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
|
14
14
|
|
15
15
|
[ ["memcached", "memcached"],
|
16
|
-
["
|
16
|
+
["remix-stash", "remix/stash"],
|
17
17
|
# ["astro-remcached", "remcached"], # Clobbers the "Memcached" constant
|
18
|
-
["memcache-client", "memcache"]
|
18
|
+
["memcache-client", "memcache"],
|
19
|
+
["dalli","dalli"]].each do |gem_name, requirement|
|
19
20
|
require requirement
|
20
21
|
gem gem_name
|
21
22
|
puts "Loaded #{gem_name} #{Gem.loaded_specs[gem_name].version.to_s rescue nil}"
|
@@ -26,6 +27,26 @@ class Remix::Stash
|
|
26
27
|
@@clusters = {:default => Remix::Stash::Cluster.new(['127.0.0.1:43042', '127.0.0.1:43043'])}
|
27
28
|
end
|
28
29
|
|
30
|
+
class Dalli::ClientCompat < Dalli::Client
|
31
|
+
def set(*args)
|
32
|
+
super(*args[0..2])
|
33
|
+
end
|
34
|
+
def get(*args)
|
35
|
+
super(args.first)
|
36
|
+
end
|
37
|
+
def get_multi(*args)
|
38
|
+
super(args.first)
|
39
|
+
end
|
40
|
+
def append(*args)
|
41
|
+
super
|
42
|
+
rescue Dalli::DalliError
|
43
|
+
end
|
44
|
+
def prepend(*args)
|
45
|
+
super
|
46
|
+
rescue Dalli::DalliError
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
29
50
|
class Bench
|
30
51
|
|
31
52
|
def initialize(loops = nil, stack_depth = nil)
|
@@ -72,23 +93,24 @@ class Bench
|
|
72
93
|
|
73
94
|
def reset_clients
|
74
95
|
@clients = {
|
75
|
-
"libm" => Memcached::Rails.new(
|
96
|
+
"libm:ascii" => Memcached::Rails.new(
|
76
97
|
['127.0.0.1:43042', '127.0.0.1:43043'],
|
77
98
|
:buffer_requests => false, :no_block => false, :namespace => "namespace"),
|
78
|
-
"libm:
|
99
|
+
"libm:ascii:pipeline" => Memcached::Rails.new(
|
79
100
|
['127.0.0.1:43042', '127.0.0.1:43043'],
|
80
|
-
:no_block => true, :buffer_requests => true, :namespace => "namespace"),
|
81
|
-
"libm:udp" => Memcached::Rails.new(
|
101
|
+
:no_block => true, :buffer_requests => true, :noreply => true, :namespace => "namespace"),
|
102
|
+
"libm:ascii:udp" => Memcached::Rails.new(
|
82
103
|
["#{UNIX_SOCKET_NAME}0", "#{UNIX_SOCKET_NAME}1"],
|
83
104
|
:buffer_requests => false, :no_block => false, :namespace => "namespace"),
|
84
|
-
"libm:
|
105
|
+
"libm:bin" => Memcached::Rails.new(
|
85
106
|
['127.0.0.1:43042', '127.0.0.1:43043'],
|
86
107
|
:buffer_requests => false, :no_block => false, :namespace => "namespace", :binary_protocol => true),
|
87
|
-
"libm:
|
108
|
+
"libm:bin:buffer" => Memcached::Rails.new(
|
88
109
|
['127.0.0.1:43042', '127.0.0.1:43043'],
|
89
110
|
:no_block => true, :buffer_requests => true, :namespace => "namespace", :binary_protocol => true),
|
90
|
-
"
|
91
|
-
"stash" => Remix::Stash.new(:root)
|
111
|
+
"mclient:ascii" => MemCache.new(['127.0.0.1:43042', '127.0.0.1:43043']),
|
112
|
+
"stash:bin" => Remix::Stash.new(:root),
|
113
|
+
"dalli:bin" => Dalli::ClientCompat.new(['127.0.0.1:43042', '127.0.0.1:43043'], :marshal => false, :threadsafe => false)}
|
92
114
|
end
|
93
115
|
|
94
116
|
|
@@ -98,19 +120,20 @@ class Bench
|
|
98
120
|
client = clients[client_name]
|
99
121
|
begin
|
100
122
|
yield client
|
101
|
-
@benchmark.report("#{test_name}
|
123
|
+
@benchmark.report("#{test_name}: #{client_name}") { @loops.times { yield client } }
|
102
124
|
rescue => e
|
103
|
-
# puts "#{test_name}:#{client_name} => #{e.
|
125
|
+
# puts "#{test_name}:#{client_name} => #{e.inspect}"
|
104
126
|
# reset_clients
|
105
127
|
end
|
106
128
|
end
|
129
|
+
puts
|
107
130
|
end
|
108
131
|
|
109
132
|
def benchmark_hashes(hashes, test_name)
|
110
133
|
hashes.each do |hash_name, int|
|
111
134
|
@m = Memcached::Rails.new(:hash => hash_name)
|
112
135
|
@benchmark.report("#{test_name}:#{hash_name}") do
|
113
|
-
@loops.times { yield int }
|
136
|
+
(@loops * 5).times { yield int }
|
114
137
|
end
|
115
138
|
end
|
116
139
|
end
|
@@ -137,7 +160,13 @@ class Bench
|
|
137
160
|
c.append @k2, @m_value
|
138
161
|
c.append @k3, @m_value
|
139
162
|
end
|
140
|
-
|
163
|
+
|
164
|
+
benchmark_clients("prepend") do |c|
|
165
|
+
c.prepend @k1, @m_value
|
166
|
+
c.prepend @k2, @m_value
|
167
|
+
c.prepend @k3, @m_value
|
168
|
+
end
|
169
|
+
|
141
170
|
benchmark_clients("delete") do |c|
|
142
171
|
c.delete @k1
|
143
172
|
c.delete @k2
|
@@ -156,6 +185,12 @@ class Bench
|
|
156
185
|
c.append @k3, @m_value
|
157
186
|
end
|
158
187
|
|
188
|
+
benchmark_clients("prepend-missing") do |c|
|
189
|
+
c.prepend @k1, @m_value
|
190
|
+
c.prepend @k2, @m_value
|
191
|
+
c.prepend @k3, @m_value
|
192
|
+
end
|
193
|
+
|
159
194
|
benchmark_clients("set-large") do |c|
|
160
195
|
c.set @k1, @m_large_value, 0, true
|
161
196
|
c.set @k2, @m_large_value, 0, true
|
@@ -167,30 +202,6 @@ class Bench
|
|
167
202
|
c.get @k2, true
|
168
203
|
c.get @k3, true
|
169
204
|
end
|
170
|
-
|
171
|
-
benchmark_clients("set-ruby") do |c|
|
172
|
-
c.set @k1, @value
|
173
|
-
c.set @k2, @value
|
174
|
-
c.set @k3, @value
|
175
|
-
end
|
176
|
-
|
177
|
-
benchmark_clients("get-ruby") do |c|
|
178
|
-
c.get @k1
|
179
|
-
c.get @k2
|
180
|
-
c.get @k3
|
181
|
-
end
|
182
|
-
|
183
|
-
benchmark_clients("set-ruby-large") do |c|
|
184
|
-
c.set @k1, @large_value
|
185
|
-
c.set @k2, @large_value
|
186
|
-
c.set @k3, @large_value
|
187
|
-
end
|
188
|
-
|
189
|
-
benchmark_clients("get-ruby-large") do |c|
|
190
|
-
c.get @k1
|
191
|
-
c.get @k2
|
192
|
-
c.get @k3
|
193
|
-
end
|
194
205
|
|
195
206
|
benchmark_hashes(Memcached::HASH_VALUES, "hash") do |i|
|
196
207
|
Rlibmemcached.memcached_generate_hash_rvalue(@k1, i)
|
data/test/unit/memcached_test.rb
CHANGED
@@ -259,9 +259,7 @@ class MemcachedTest < Test::Unit::TestCase
|
|
259
259
|
|
260
260
|
def test_get_from_last
|
261
261
|
cache = Memcached.new(@servers, :distribution => :random)
|
262
|
-
10.times
|
263
|
-
cache.set key, n
|
264
|
-
end
|
262
|
+
10.times { |n| cache.set key, n }
|
265
263
|
10.times do
|
266
264
|
assert_equal cache.get(key), cache.get_from_last(key)
|
267
265
|
end
|
@@ -390,6 +388,12 @@ class MemcachedTest < Test::Unit::TestCase
|
|
390
388
|
@cache.get(["#{key}_1", "#{key}_2"])
|
391
389
|
)
|
392
390
|
end
|
391
|
+
|
392
|
+
def test_get_multi_empty_string
|
393
|
+
@cache.set "#{key}_1", "", 0, false
|
394
|
+
assert_equal({"#{key}_1" => ""},
|
395
|
+
@cache.get(["#{key}_1"], false))
|
396
|
+
end
|
393
397
|
|
394
398
|
def test_get_multi_checks_types
|
395
399
|
assert_raises(TypeError, ArgumentError) do
|
data/test/unit/rails_test.rb
CHANGED
@@ -19,13 +19,18 @@ class RailsTest < Test::Unit::TestCase
|
|
19
19
|
|
20
20
|
def test_get_multi
|
21
21
|
@cache.set key, @value
|
22
|
-
result = @cache.get_multi([key])
|
23
22
|
assert_equal(
|
24
23
|
{key => @value},
|
25
|
-
|
26
|
-
)
|
24
|
+
@cache.get_multi([key]))
|
27
25
|
end
|
28
|
-
|
26
|
+
|
27
|
+
def test_get_multi_empty_string
|
28
|
+
@cache.set key, "", 0, true
|
29
|
+
assert_equal(
|
30
|
+
{key => ""},
|
31
|
+
@cache.get_multi([key], true))
|
32
|
+
end
|
33
|
+
|
29
34
|
def test_delete
|
30
35
|
@cache.set key, @value
|
31
36
|
assert_nothing_raised do
|
metadata
CHANGED
@@ -3,10 +3,8 @@ name: memcached
|
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
|
-
- 0
|
7
|
-
- 20
|
8
6
|
- 1
|
9
|
-
version:
|
7
|
+
version: "1"
|
10
8
|
platform: ruby
|
11
9
|
authors:
|
12
10
|
- Evan Weaver
|
@@ -35,7 +33,7 @@ cert_chain:
|
|
35
33
|
yZ0=
|
36
34
|
-----END CERTIFICATE-----
|
37
35
|
|
38
|
-
date: 2010-08
|
36
|
+
date: 2010-09-08 00:00:00 -07:00
|
39
37
|
default_executable:
|
40
38
|
dependencies: []
|
41
39
|
|
@@ -54,6 +52,7 @@ extra_rdoc_files:
|
|
54
52
|
- lib/memcached.rb
|
55
53
|
- lib/memcached/behaviors.rb
|
56
54
|
- lib/memcached/exceptions.rb
|
55
|
+
- lib/memcached/experimental.rb
|
57
56
|
- lib/memcached/memcached.rb
|
58
57
|
- lib/memcached/rails.rb
|
59
58
|
files:
|
metadata.gz.sig
CHANGED
Binary file
|