memcached 1.2.4.pre → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +1 -1
- data/Rakefile +14 -0
- data/ext/rlibmemcached.i +33 -27
- data/ext/rlibmemcached_wrap.c +78 -34
- data/memcached.gemspec +2 -2
- data/test/profile/benchmark.rb +43 -37
- metadata +5 -6
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
gem 'echoe', '>= 4.5.6'
|
1
2
|
require 'echoe'
|
2
3
|
|
3
4
|
Echoe.new("memcached") do |p|
|
@@ -20,6 +21,19 @@ task :exceptions do
|
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
24
|
+
task :test_all do
|
25
|
+
if !system("rvm use ree-1.8.7-2010.02 && rake clean && rake")
|
26
|
+
puts "REE test failed"
|
27
|
+
exit(1)
|
28
|
+
end
|
29
|
+
if !system("rvm use ruby-1.9.2 && rake clean && rake")
|
30
|
+
puts "1.9 test failed"
|
31
|
+
exit(1)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
task :prerelease => [:test_all]
|
36
|
+
|
23
37
|
task :benchmark do
|
24
38
|
exec("ruby #{File.dirname(__FILE__)}/test/profile/benchmark.rb")
|
25
39
|
end
|
data/ext/rlibmemcached.i
CHANGED
@@ -39,7 +39,7 @@
|
|
39
39
|
|
40
40
|
// Array of strings map for multiget
|
41
41
|
%typemap(in) (const char **keys, size_t *key_length, size_t number_of_keys) {
|
42
|
-
int i;
|
42
|
+
unsigned int i;
|
43
43
|
Check_Type($input, T_ARRAY);
|
44
44
|
$3 = (unsigned int) RARRAY_LEN($input);
|
45
45
|
$2 = (size_t *) malloc(($3+1)*sizeof(size_t));
|
@@ -102,12 +102,6 @@
|
|
102
102
|
$result = UINT2NUM($1);
|
103
103
|
};
|
104
104
|
|
105
|
-
// Void type strings without lengths for prefix_key callback
|
106
|
-
// Currently not used by the gem
|
107
|
-
%typemap(out) (void *) {
|
108
|
-
$result = rb_str_new2($1);
|
109
|
-
};
|
110
|
-
|
111
105
|
// String for memcached_fetch
|
112
106
|
%typemap(in, numinputs=0) (char *key, size_t *key_length) {
|
113
107
|
char string[256];
|
@@ -122,6 +116,7 @@
|
|
122
116
|
}
|
123
117
|
|
124
118
|
// Array of strings
|
119
|
+
// Only used by memcached_stat_get_keys() and not performance-critical
|
125
120
|
%typemap(out) (char **) {
|
126
121
|
int i;
|
127
122
|
VALUE ary = rb_ary_new();
|
@@ -147,44 +142,56 @@
|
|
147
142
|
|
148
143
|
//// Custom C functions
|
149
144
|
|
145
|
+
VALUE rb_str_new_by_ref(char *ptr, long len);
|
146
|
+
%{
|
147
|
+
VALUE rb_str_new_by_ref(char *ptr, long len)
|
148
|
+
{
|
149
|
+
NEWOBJ(str, struct RString);
|
150
|
+
OBJSETUP(str, rb_cString, T_STRING);
|
151
|
+
#ifdef RSTRING_NOEMBED
|
152
|
+
/* Ruby 1.9 */
|
153
|
+
str->as.heap.ptr = ptr;
|
154
|
+
str->as.heap.len = len;
|
155
|
+
str->as.heap.aux.capa = len + 1;
|
156
|
+
// Set STR_NOEMBED
|
157
|
+
FL_SET(str, FL_USER1);
|
158
|
+
#else
|
159
|
+
/* Ruby 1.8 */
|
160
|
+
str->ptr = ptr;
|
161
|
+
str->len = len;
|
162
|
+
str->aux.capa = 0;
|
163
|
+
#endif
|
164
|
+
return (VALUE)str;
|
165
|
+
}
|
166
|
+
%}
|
167
|
+
|
150
168
|
//// Manual wrappers
|
151
169
|
|
152
|
-
// Single get
|
153
|
-
// of the retval/argout split, so it truncates return values with \0 in them. There is probably a better
|
154
|
-
// way to do this.
|
170
|
+
// Single get
|
155
171
|
VALUE memcached_get_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error);
|
156
172
|
%{
|
157
173
|
VALUE memcached_get_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error) {
|
158
|
-
VALUE ret;
|
159
174
|
size_t value_length = 0;
|
160
175
|
char *value = memcached_get(ptr, key, key_length, &value_length, flags, error);
|
161
|
-
|
162
|
-
free(value);
|
163
|
-
return ret;
|
176
|
+
return rb_str_new_by_ref(value, value_length);
|
164
177
|
};
|
165
178
|
%}
|
166
179
|
|
167
180
|
VALUE memcached_get_len_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t user_spec_len, uint32_t *flags, memcached_return *error);
|
168
181
|
%{
|
169
182
|
VALUE memcached_get_len_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t user_spec_len, uint32_t *flags, memcached_return *error) {
|
170
|
-
VALUE ret;
|
171
183
|
size_t value_length = 0;
|
172
184
|
char *value = memcached_get_len(ptr, key, key_length, user_spec_len, &value_length, flags, error);
|
173
|
-
|
174
|
-
free(value);
|
175
|
-
return ret;
|
185
|
+
return rb_str_new_by_ref(value, value_length);
|
176
186
|
};
|
177
187
|
%}
|
178
188
|
|
179
189
|
VALUE memcached_get_from_last_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error);
|
180
190
|
%{
|
181
191
|
VALUE memcached_get_from_last_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error) {
|
182
|
-
VALUE ret;
|
183
192
|
size_t value_length = 0;
|
184
193
|
char *value = memcached_get_from_last(ptr, key, key_length, &value_length, flags, error);
|
185
|
-
|
186
|
-
free(value);
|
187
|
-
return ret;
|
194
|
+
return rb_str_new_by_ref(value, value_length);
|
188
195
|
};
|
189
196
|
%}
|
190
197
|
|
@@ -193,12 +200,11 @@ VALUE memcached_fetch_rvalue(memcached_st *ptr, char *key, size_t *key_length, u
|
|
193
200
|
%{
|
194
201
|
VALUE memcached_fetch_rvalue(memcached_st *ptr, char *key, size_t *key_length, uint32_t *flags, memcached_return *error) {
|
195
202
|
size_t value_length = 0;
|
196
|
-
VALUE
|
203
|
+
VALUE ary = rb_ary_new();
|
197
204
|
char *value = memcached_fetch(ptr, key, key_length, &value_length, flags, error);
|
198
|
-
VALUE
|
199
|
-
rb_ary_push(
|
200
|
-
|
201
|
-
return result;
|
205
|
+
VALUE str = rb_str_new_by_ref(value, value_length);
|
206
|
+
rb_ary_push(ary, str);
|
207
|
+
return ary;
|
202
208
|
};
|
203
209
|
%}
|
204
210
|
|
data/ext/rlibmemcached_wrap.c
CHANGED
@@ -1821,8 +1821,9 @@ int SWIG_Ruby_arity( VALUE proc, int minimal )
|
|
1821
1821
|
#define SWIGTYPE_p_size_t swig_types[29]
|
1822
1822
|
#define SWIGTYPE_p_uint32_t swig_types[30]
|
1823
1823
|
#define SWIGTYPE_p_uint64_t swig_types[31]
|
1824
|
-
|
1825
|
-
static
|
1824
|
+
#define SWIGTYPE_p_void swig_types[32]
|
1825
|
+
static swig_type_info *swig_types[34];
|
1826
|
+
static swig_module_info swig_module = {swig_types, 33, 0, 0, 0, 0};
|
1826
1827
|
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
|
1827
1828
|
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
|
1828
1829
|
|
@@ -2252,44 +2253,55 @@ SWIG_From_unsigned_SS_int (unsigned int value)
|
|
2252
2253
|
}
|
2253
2254
|
|
2254
2255
|
|
2256
|
+
VALUE rb_str_new_by_ref(char *ptr, long len)
|
2257
|
+
{
|
2258
|
+
NEWOBJ(str, struct RString);
|
2259
|
+
OBJSETUP(str, rb_cString, T_STRING);
|
2260
|
+
#ifdef RSTRING_NOEMBED
|
2261
|
+
/* Ruby 1.9 */
|
2262
|
+
str->as.heap.ptr = ptr;
|
2263
|
+
str->as.heap.len = len;
|
2264
|
+
str->as.heap.aux.capa = len + 1;
|
2265
|
+
// Set STR_NOEMBED
|
2266
|
+
FL_SET(str, FL_USER1);
|
2267
|
+
#else
|
2268
|
+
/* Ruby 1.8 */
|
2269
|
+
str->ptr = ptr;
|
2270
|
+
str->len = len;
|
2271
|
+
str->aux.capa = 0;
|
2272
|
+
#endif
|
2273
|
+
return (VALUE)str;
|
2274
|
+
}
|
2275
|
+
|
2276
|
+
|
2255
2277
|
VALUE memcached_get_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error) {
|
2256
|
-
VALUE ret;
|
2257
2278
|
size_t value_length = 0;
|
2258
2279
|
char *value = memcached_get(ptr, key, key_length, &value_length, flags, error);
|
2259
|
-
|
2260
|
-
free(value);
|
2261
|
-
return ret;
|
2280
|
+
return rb_str_new_by_ref(value, value_length);
|
2262
2281
|
};
|
2263
2282
|
|
2264
2283
|
|
2265
2284
|
VALUE memcached_get_len_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t user_spec_len, uint32_t *flags, memcached_return *error) {
|
2266
|
-
VALUE ret;
|
2267
2285
|
size_t value_length = 0;
|
2268
2286
|
char *value = memcached_get_len(ptr, key, key_length, user_spec_len, &value_length, flags, error);
|
2269
|
-
|
2270
|
-
free(value);
|
2271
|
-
return ret;
|
2287
|
+
return rb_str_new_by_ref(value, value_length);
|
2272
2288
|
};
|
2273
2289
|
|
2274
2290
|
|
2275
2291
|
VALUE memcached_get_from_last_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error) {
|
2276
|
-
VALUE ret;
|
2277
2292
|
size_t value_length = 0;
|
2278
2293
|
char *value = memcached_get_from_last(ptr, key, key_length, &value_length, flags, error);
|
2279
|
-
|
2280
|
-
free(value);
|
2281
|
-
return ret;
|
2294
|
+
return rb_str_new_by_ref(value, value_length);
|
2282
2295
|
};
|
2283
2296
|
|
2284
2297
|
|
2285
2298
|
VALUE memcached_fetch_rvalue(memcached_st *ptr, char *key, size_t *key_length, uint32_t *flags, memcached_return *error) {
|
2286
2299
|
size_t value_length = 0;
|
2287
|
-
VALUE
|
2300
|
+
VALUE ary = rb_ary_new();
|
2288
2301
|
char *value = memcached_fetch(ptr, key, key_length, &value_length, flags, error);
|
2289
|
-
VALUE
|
2290
|
-
rb_ary_push(
|
2291
|
-
|
2292
|
-
return result;
|
2302
|
+
VALUE str = rb_str_new_by_ref(value, value_length);
|
2303
|
+
rb_ary_push(ary, str);
|
2304
|
+
return ary;
|
2293
2305
|
};
|
2294
2306
|
|
2295
2307
|
|
@@ -5647,9 +5659,7 @@ _wrap_MemcachedSt_user_data_get(int argc, VALUE *argv, VALUE self) {
|
|
5647
5659
|
}
|
5648
5660
|
arg1 = (struct memcached_st *)(argp1);
|
5649
5661
|
result = (void *) ((arg1)->user_data);
|
5650
|
-
|
5651
|
-
vresult = rb_str_new2(result);
|
5652
|
-
}
|
5662
|
+
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
|
5653
5663
|
return vresult;
|
5654
5664
|
fail:
|
5655
5665
|
return Qnil;
|
@@ -8328,9 +8338,7 @@ _wrap_memcached_callback_get(int argc, VALUE *argv, VALUE self) {
|
|
8328
8338
|
}
|
8329
8339
|
arg2 = (memcached_callback)(val2);
|
8330
8340
|
result = (void *)memcached_callback_get(arg1,arg2,arg3);
|
8331
|
-
|
8332
|
-
vresult = rb_str_new2(result);
|
8333
|
-
}
|
8341
|
+
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
|
8334
8342
|
if (SWIG_IsTmpObj(res3)) {
|
8335
8343
|
vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_unsigned_SS_short((*arg3)));
|
8336
8344
|
} else {
|
@@ -8545,9 +8553,7 @@ _wrap_memcached_get_user_data(int argc, VALUE *argv, VALUE self) {
|
|
8545
8553
|
}
|
8546
8554
|
arg1 = (memcached_st *)(argp1);
|
8547
8555
|
result = (void *)memcached_get_user_data(arg1);
|
8548
|
-
|
8549
|
-
vresult = rb_str_new2(result);
|
8550
|
-
}
|
8556
|
+
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
|
8551
8557
|
return vresult;
|
8552
8558
|
fail:
|
8553
8559
|
return Qnil;
|
@@ -8579,9 +8585,7 @@ _wrap_memcached_set_user_data(int argc, VALUE *argv, VALUE self) {
|
|
8579
8585
|
}
|
8580
8586
|
}
|
8581
8587
|
result = (void *)memcached_set_user_data(arg1,arg2);
|
8582
|
-
|
8583
|
-
vresult = rb_str_new2(result);
|
8584
|
-
}
|
8588
|
+
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
|
8585
8589
|
return vresult;
|
8586
8590
|
fail:
|
8587
8591
|
return Qnil;
|
@@ -8760,7 +8764,7 @@ _wrap_memcached_mget(int argc, VALUE *argv, VALUE self) {
|
|
8760
8764
|
}
|
8761
8765
|
arg1 = (memcached_st *)(argp1);
|
8762
8766
|
{
|
8763
|
-
int i;
|
8767
|
+
unsigned int i;
|
8764
8768
|
Check_Type(argv[1], T_ARRAY);
|
8765
8769
|
arg4 = (unsigned int) RARRAY_LEN(argv[1]);
|
8766
8770
|
arg3 = (size_t *) malloc((arg4+1)*sizeof(size_t));
|
@@ -8810,7 +8814,7 @@ _wrap_memcached_mget_len(int argc, VALUE *argv, VALUE self) {
|
|
8810
8814
|
}
|
8811
8815
|
arg1 = (memcached_st *)(argp1);
|
8812
8816
|
{
|
8813
|
-
int i;
|
8817
|
+
unsigned int i;
|
8814
8818
|
Check_Type(argv[1], T_ARRAY);
|
8815
8819
|
arg4 = (unsigned int) RARRAY_LEN(argv[1]);
|
8816
8820
|
arg3 = (size_t *) malloc((arg4+1)*sizeof(size_t));
|
@@ -8952,7 +8956,7 @@ _wrap_memcached_mget_by_key(int argc, VALUE *argv, VALUE self) {
|
|
8952
8956
|
}
|
8953
8957
|
arg3 = (size_t)(val3);
|
8954
8958
|
{
|
8955
|
-
int i;
|
8959
|
+
unsigned int i;
|
8956
8960
|
Check_Type(argv[3], T_ARRAY);
|
8957
8961
|
arg6 = (unsigned int) RARRAY_LEN(argv[3]);
|
8958
8962
|
arg5 = (size_t *) malloc((arg6+1)*sizeof(size_t));
|
@@ -12410,6 +12414,41 @@ fail:
|
|
12410
12414
|
}
|
12411
12415
|
|
12412
12416
|
|
12417
|
+
SWIGINTERN VALUE
|
12418
|
+
_wrap_rb_str_new_by_ref(int argc, VALUE *argv, VALUE self) {
|
12419
|
+
char *arg1 = (char *) 0 ;
|
12420
|
+
long arg2 ;
|
12421
|
+
int res1 ;
|
12422
|
+
char *buf1 = 0 ;
|
12423
|
+
int alloc1 = 0 ;
|
12424
|
+
long val2 ;
|
12425
|
+
int ecode2 = 0 ;
|
12426
|
+
VALUE result;
|
12427
|
+
VALUE vresult = Qnil;
|
12428
|
+
|
12429
|
+
if ((argc < 2) || (argc > 2)) {
|
12430
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
|
12431
|
+
}
|
12432
|
+
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
|
12433
|
+
if (!SWIG_IsOK(res1)) {
|
12434
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char *","rb_str_new_by_ref", 1, argv[0] ));
|
12435
|
+
}
|
12436
|
+
arg1 = (char *)(buf1);
|
12437
|
+
ecode2 = SWIG_AsVal_long(argv[1], &val2);
|
12438
|
+
if (!SWIG_IsOK(ecode2)) {
|
12439
|
+
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "long","rb_str_new_by_ref", 2, argv[1] ));
|
12440
|
+
}
|
12441
|
+
arg2 = (long)(val2);
|
12442
|
+
result = (VALUE)rb_str_new_by_ref(arg1,arg2);
|
12443
|
+
vresult = result;
|
12444
|
+
if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
|
12445
|
+
return vresult;
|
12446
|
+
fail:
|
12447
|
+
if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
|
12448
|
+
return Qnil;
|
12449
|
+
}
|
12450
|
+
|
12451
|
+
|
12413
12452
|
SWIGINTERN VALUE
|
12414
12453
|
_wrap_memcached_get_rvalue(int argc, VALUE *argv, VALUE self) {
|
12415
12454
|
memcached_st *arg1 = (memcached_st *) 0 ;
|
@@ -12760,6 +12799,7 @@ static swig_type_info _swigt__p_sasl_callback_t = {"_p_sasl_callback_t", "sasl_c
|
|
12760
12799
|
static swig_type_info _swigt__p_size_t = {"_p_size_t", "size_t *", 0, 0, (void*)0, 0};
|
12761
12800
|
static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0};
|
12762
12801
|
static swig_type_info _swigt__p_uint64_t = {"_p_uint64_t", "uint64_t *", 0, 0, (void*)0, 0};
|
12802
|
+
static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
|
12763
12803
|
|
12764
12804
|
static swig_type_info *swig_type_initial[] = {
|
12765
12805
|
&_swigt__p_addrinfo,
|
@@ -12794,6 +12834,7 @@ static swig_type_info *swig_type_initial[] = {
|
|
12794
12834
|
&_swigt__p_size_t,
|
12795
12835
|
&_swigt__p_uint32_t,
|
12796
12836
|
&_swigt__p_uint64_t,
|
12837
|
+
&_swigt__p_void,
|
12797
12838
|
};
|
12798
12839
|
|
12799
12840
|
static swig_cast_info _swigc__p_addrinfo[] = { {&_swigt__p_addrinfo, 0, 0, 0},{0, 0, 0, 0}};
|
@@ -12828,6 +12869,7 @@ static swig_cast_info _swigc__p_sasl_callback_t[] = { {&_swigt__p_sasl_callback
|
|
12828
12869
|
static swig_cast_info _swigc__p_size_t[] = { {&_swigt__p_size_t, 0, 0, 0},{0, 0, 0, 0}};
|
12829
12870
|
static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
|
12830
12871
|
static swig_cast_info _swigc__p_uint64_t[] = { {&_swigt__p_uint64_t, 0, 0, 0},{0, 0, 0, 0}};
|
12872
|
+
static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
|
12831
12873
|
|
12832
12874
|
static swig_cast_info *swig_cast_initial[] = {
|
12833
12875
|
_swigc__p_addrinfo,
|
@@ -12862,6 +12904,7 @@ static swig_cast_info *swig_cast_initial[] = {
|
|
12862
12904
|
_swigc__p_size_t,
|
12863
12905
|
_swigc__p_uint32_t,
|
12864
12906
|
_swigc__p_uint64_t,
|
12907
|
+
_swigc__p_void,
|
12865
12908
|
};
|
12866
12909
|
|
12867
12910
|
|
@@ -13578,6 +13621,7 @@ SWIGEXPORT void Init_rlibmemcached(void) {
|
|
13578
13621
|
rb_define_module_function(mRlibmemcached, "memcached_destroy_sasl_auth_data", _wrap_memcached_destroy_sasl_auth_data, -1);
|
13579
13622
|
rb_define_module_function(mRlibmemcached, "memcached_get_sasl_callbacks", _wrap_memcached_get_sasl_callbacks, -1);
|
13580
13623
|
rb_define_module_function(mRlibmemcached, "memcached_sasl_authenticate_connection", _wrap_memcached_sasl_authenticate_connection, -1);
|
13624
|
+
rb_define_module_function(mRlibmemcached, "rb_str_new_by_ref", _wrap_rb_str_new_by_ref, -1);
|
13581
13625
|
rb_define_module_function(mRlibmemcached, "memcached_get_rvalue", _wrap_memcached_get_rvalue, -1);
|
13582
13626
|
rb_define_module_function(mRlibmemcached, "memcached_get_len_rvalue", _wrap_memcached_get_len_rvalue, -1);
|
13583
13627
|
rb_define_module_function(mRlibmemcached, "memcached_get_from_last_rvalue", _wrap_memcached_get_from_last_rvalue, -1);
|
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 = "1.2.
|
5
|
+
s.version = "1.2.5"
|
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-03-
|
10
|
+
s.date = %q{2011-03-30}
|
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
@@ -3,7 +3,7 @@ HERE = File.dirname(__FILE__)
|
|
3
3
|
$LOAD_PATH << "#{HERE}/../../lib/"
|
4
4
|
UNIX_SOCKET_NAME = File.join(ENV['TMPDIR']||'/tmp','memcached')
|
5
5
|
|
6
|
-
require 'memcached'
|
6
|
+
require 'memcached' if !defined?(JRUBY_VERSION)
|
7
7
|
require 'benchmark'
|
8
8
|
require 'rubygems'
|
9
9
|
require 'ruby-debug' if ENV['DEBUG']
|
@@ -14,16 +14,13 @@ puts `ruby -v`
|
|
14
14
|
puts `env | egrep '^RUBY'`
|
15
15
|
puts "Ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
|
16
16
|
|
17
|
-
[
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
require requirement
|
25
|
-
gem gem_name
|
26
|
-
puts "Loaded #{gem_name} #{Gem.loaded_specs[gem_name].version.to_s rescue nil}"
|
17
|
+
[["memcached"], ["remix-stash", "remix/stash"], ["memcache-client", "memcache"], ["kgio"], ["dalli"]].each do |gem_name, requirement|
|
18
|
+
begin
|
19
|
+
require requirement || gem_name
|
20
|
+
gem gem_name
|
21
|
+
puts "Loaded #{gem_name} #{Gem.loaded_specs[gem_name].version.to_s rescue nil}"
|
22
|
+
rescue LoadError
|
23
|
+
end
|
27
24
|
end
|
28
25
|
|
29
26
|
class Remix::Stash
|
@@ -98,25 +95,30 @@ class Bench
|
|
98
95
|
|
99
96
|
def reset_clients
|
100
97
|
@clients = {
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
98
|
+
"mclient:ascii" => MemCache.new(['127.0.0.1:43042', '127.0.0.1:43043']),
|
99
|
+
"stash:bin" => Remix::Stash.new(:root),
|
100
|
+
"dalli:bin" => Dalli::ClientCompat.new(['127.0.0.1:43042', '127.0.0.1:43043'], :marshal => false, :threadsafe => false)}
|
101
|
+
|
102
|
+
if defined?(JRUBY_VERSION)
|
103
|
+
@clients.merge!({}) # jruby-memcache-client, #spymemcached
|
104
|
+
else
|
105
|
+
@clients.merge!({
|
106
|
+
"libm:ascii" => Memcached::Rails.new(
|
107
|
+
['127.0.0.1:43042', '127.0.0.1:43043'],
|
108
|
+
:buffer_requests => false, :no_block => false, :namespace => "namespace"),
|
109
|
+
"libm:ascii:pipeline" => Memcached::Rails.new(
|
110
|
+
['127.0.0.1:43042', '127.0.0.1:43043'],
|
111
|
+
:no_block => true, :buffer_requests => true, :noreply => true, :namespace => "namespace"),
|
112
|
+
"libm:ascii:udp" => Memcached::Rails.new(
|
113
|
+
["#{UNIX_SOCKET_NAME}0", "#{UNIX_SOCKET_NAME}1"],
|
114
|
+
:buffer_requests => false, :no_block => false, :namespace => "namespace"),
|
115
|
+
"libm:bin" => Memcached::Rails.new(
|
116
|
+
['127.0.0.1:43042', '127.0.0.1:43043'],
|
117
|
+
:buffer_requests => false, :no_block => false, :namespace => "namespace", :binary_protocol => true),
|
118
|
+
"libm:bin:buffer" => Memcached::Rails.new(
|
119
|
+
['127.0.0.1:43042', '127.0.0.1:43043'],
|
120
|
+
:no_block => true, :buffer_requests => true, :namespace => "namespace", :binary_protocol => true)})
|
121
|
+
end
|
120
122
|
end
|
121
123
|
|
122
124
|
def benchmark_clients(test_name, populate_keys = true)
|
@@ -138,11 +140,13 @@ class Bench
|
|
138
140
|
client.delete @k3
|
139
141
|
end
|
140
142
|
yield client
|
143
|
+
GC.disable
|
141
144
|
@benchmark.report("#{test_name}: #{client_name}") { @loops.times { yield client } }
|
142
145
|
rescue Exception => e
|
143
146
|
puts "#{test_name}: #{client_name} => #{e.inspect}" if ENV["DEBUG"]
|
144
147
|
reset_clients
|
145
148
|
end
|
149
|
+
GC.enable
|
146
150
|
end
|
147
151
|
puts
|
148
152
|
end
|
@@ -221,13 +225,15 @@ class Bench
|
|
221
225
|
c.get @k3, true
|
222
226
|
end
|
223
227
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
228
|
+
if defined?(Memcached)
|
229
|
+
benchmark_hashes(Memcached::HASH_VALUES, "hash") do |i|
|
230
|
+
Rlibmemcached.memcached_generate_hash_rvalue(@k1, i)
|
231
|
+
Rlibmemcached.memcached_generate_hash_rvalue(@k2, i)
|
232
|
+
Rlibmemcached.memcached_generate_hash_rvalue(@k3, i)
|
233
|
+
Rlibmemcached.memcached_generate_hash_rvalue(@k4, i)
|
234
|
+
Rlibmemcached.memcached_generate_hash_rvalue(@k5, i)
|
235
|
+
Rlibmemcached.memcached_generate_hash_rvalue(@k6, i)
|
236
|
+
end
|
231
237
|
end
|
232
238
|
end
|
233
239
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memcached
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 1.2.4.pre
|
9
|
+
- 5
|
10
|
+
version: 1.2.5
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Evan Weaver
|
@@ -37,7 +36,7 @@ cert_chain:
|
|
37
36
|
yZ0=
|
38
37
|
-----END CERTIFICATE-----
|
39
38
|
|
40
|
-
date: 2011-03-
|
39
|
+
date: 2011-03-30 00:00:00 -07:00
|
41
40
|
default_executable:
|
42
41
|
dependencies: []
|
43
42
|
|
metadata.gz.sig
CHANGED
Binary file
|