memcached 1.1.2 → 1.1.3
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 +2 -0
- data/README +11 -11
- data/ext/extconf.rb +5 -5
- data/ext/rlibmemcached.i +12 -17
- data/ext/rlibmemcached_wrap.c +4 -69
- data/lib/memcached/memcached.rb +5 -7
- data/memcached.gemspec +2 -2
- data/test/profile/exercise.rb +31 -5
- data/test/profile/valgrind.rb +1 -1
- data/test/test_helper.rb +4 -6
- data/test/unit/memcached_test.rb +0 -1
- metadata +4 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -7,7 +7,7 @@ An interface to the libmemcached C client.
|
|
7
7
|
|
8
8
|
Copyright 2009 Cloudburst, LLC. Licensed under the AFL 3. See the included LICENSE file. Portions copyright 2007-2009 TangentOrg, Brian Aker, licensed under the BSD license, and used with permission.
|
9
9
|
|
10
|
-
The public certificate for this gem is here[http://blog.evanweaver.com/files/evan_weaver-original-public_cert.pem].
|
10
|
+
The public certificate for this gem is here[http://blog.evanweaver.com/files/evan_weaver-original-public_cert.pem].
|
11
11
|
|
12
12
|
If you use this software, please {make a donation}[http://blog.evanweaver.com/donate/], or {recommend Evan}[http://www.workingwithrails.com/person/7739-evan-weaver] at Working with Rails.
|
13
13
|
|
@@ -26,7 +26,7 @@ You need Ruby 1.8.7 or Ruby 1.9.2. Other versions may work, but are not guarante
|
|
26
26
|
|
27
27
|
Install the gem:
|
28
28
|
sudo gem install memcached --no-rdoc --no-ri
|
29
|
-
|
29
|
+
|
30
30
|
== Usage
|
31
31
|
|
32
32
|
Start a local networked memcached server:
|
@@ -36,9 +36,9 @@ Now, in Ruby, require the library and instantiate a Memcached object at a global
|
|
36
36
|
|
37
37
|
require 'memcached'
|
38
38
|
$cache = Memcached.new("localhost:11211")
|
39
|
-
|
39
|
+
|
40
40
|
Now you can set things and get things:
|
41
|
-
|
41
|
+
|
42
42
|
value = 'hello'
|
43
43
|
$cache.set 'test', value
|
44
44
|
$cache.get 'test' #=> "hello"
|
@@ -55,9 +55,9 @@ You can get multiple values at once:
|
|
55
55
|
value = 'hello'
|
56
56
|
$cache.set 'test', value
|
57
57
|
$cache.set 'test2', value
|
58
|
-
$cache.get ['test', 'test2', 'missing']
|
58
|
+
$cache.get ['test', 'test2', 'missing']
|
59
59
|
#=> {"test" => "hello", "test2" => "hello"}
|
60
|
-
|
60
|
+
|
61
61
|
You can set a counter and increment it:
|
62
62
|
|
63
63
|
start = 1
|
@@ -69,7 +69,7 @@ You can set a counter and increment it:
|
|
69
69
|
You can get some server stats:
|
70
70
|
|
71
71
|
$cache.stats #=> {..., :bytes_written=>[62], :version=>["1.2.4"] ...}
|
72
|
-
|
72
|
+
|
73
73
|
Note that the API is not the same as that of <b>Ruby-MemCache</b> or <b>memcache-client</b>. In particular, <tt>nil</tt> is a valid record value. Memcached#get does not return <tt>nil</tt> on failure, rather it raises <b>Memcached::NotFound</b>. This is consistent with the behavior of memcached itself. For example:
|
74
74
|
|
75
75
|
$cache.set 'test', nil
|
@@ -79,7 +79,7 @@ Note that the API is not the same as that of <b>Ruby-MemCache</b> or <b>memcache
|
|
79
79
|
|
80
80
|
== Legacy applications
|
81
81
|
|
82
|
-
There is a compatibility wrapper for legacy applications called Memcached::Rails.
|
82
|
+
There is a compatibility wrapper for legacy applications called Memcached::Rails.
|
83
83
|
|
84
84
|
== Threading
|
85
85
|
|
@@ -90,14 +90,14 @@ There is a compatibility wrapper for legacy applications called Memcached::Rails
|
|
90
90
|
# Perform operations on cache, not $cache
|
91
91
|
cache.set 'example', 1
|
92
92
|
cache.get 'example'
|
93
|
-
end
|
93
|
+
end
|
94
94
|
|
95
95
|
# Join the thread so that exceptions don't get lost
|
96
96
|
thread.join
|
97
|
-
|
97
|
+
|
98
98
|
== Benchmarks
|
99
99
|
|
100
|
-
<b>memcached</b>, correctly configured, is
|
100
|
+
<b>memcached</b>, correctly configured, is between 5x and 60x faster than <b>memcache-client</b> and <b>dalli</b>. See BENCHMARKS[link:files/BENCHMARKS.html] for details.
|
101
101
|
|
102
102
|
== Reporting problems
|
103
103
|
|
data/ext/extconf.rb
CHANGED
@@ -48,7 +48,7 @@ def check_libmemcached
|
|
48
48
|
|
49
49
|
Dir.chdir(HERE) do
|
50
50
|
if File.exist?("lib")
|
51
|
-
puts "Libmemcached already
|
51
|
+
puts "Libmemcached already configured; run 'rake clean' first if you need to reconfigure."
|
52
52
|
else
|
53
53
|
# have_sasl check may fail on OSX, skip it
|
54
54
|
# unless RUBY_PLATFORM =~ /darwin/ or have_library('sasl2')
|
@@ -70,12 +70,12 @@ def check_libmemcached
|
|
70
70
|
|
71
71
|
Dir.chdir(BUNDLE_PATH) do
|
72
72
|
run("env CFLAGS='-fPIC #{$CFLAGS}' LDFLAGS='-fPIC #{$LDFLAGS}' ./configure --prefix=#{HERE} --without-memcached --disable-shared --disable-utils --disable-dependency-tracking #{$EXTRA_CONF} 2>&1", "Configuring libmemcached.")
|
73
|
-
|
74
|
-
#Running the make command in another script invoked by another shell command solves the "cd ." issue on FreeBSD 6+
|
75
|
-
run("GMAKE_CMD='#{GMAKE_CMD}' CXXFLAGS='#{$CXXFLAGS}' SOURCE_DIR='#{BUNDLE_PATH}' HERE='#{HERE}' ruby ../extconf-make.rb", "Making libmemcached.")
|
76
73
|
end
|
74
|
+
end
|
77
75
|
|
78
|
-
|
76
|
+
Dir.chdir(BUNDLE_PATH) do
|
77
|
+
#Running the make command in another script invoked by another shell command solves the "cd ." issue on FreeBSD 6+
|
78
|
+
run("GMAKE_CMD='#{GMAKE_CMD}' CXXFLAGS='#{$CXXFLAGS}' SOURCE_DIR='#{BUNDLE_PATH}' HERE='#{HERE}' ruby ../extconf-make.rb", "Making libmemcached.")
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
data/ext/rlibmemcached.i
CHANGED
@@ -13,10 +13,18 @@
|
|
13
13
|
%include "typemaps.i"
|
14
14
|
%include "libmemcached/visibility.h"
|
15
15
|
|
16
|
+
//// Memory management
|
17
|
+
|
16
18
|
// Register libmemcached's struct free function to prevent memory leaks
|
17
19
|
%freefunc memcached_st "memcached_free";
|
18
20
|
%freefunc memcached_server_st "memcached_server_free";
|
19
21
|
|
22
|
+
// Register which functions generate new objects
|
23
|
+
%newobject memcached_server_by_key;
|
24
|
+
%newobject memcached_create;
|
25
|
+
%newobject memcached_clone;
|
26
|
+
%newobject memcached_stat_get_value;
|
27
|
+
|
20
28
|
// %trackobjects; // Doesn't fix any interesting leaks
|
21
29
|
|
22
30
|
//// Input maps
|
@@ -106,13 +114,13 @@
|
|
106
114
|
$1 = string;
|
107
115
|
$2 = &length;
|
108
116
|
};
|
117
|
+
|
118
|
+
// Strings with lengths
|
109
119
|
%typemap(argout) (char *key, size_t *key_length) {
|
110
|
-
// Pushes an empty string when *key_length == 0
|
111
120
|
rb_ary_push($result, rb_str_new($1, *$2));
|
112
121
|
}
|
113
122
|
|
114
123
|
// Array of strings
|
115
|
-
|
116
124
|
%typemap(out) (char **) {
|
117
125
|
int i;
|
118
126
|
VALUE ary = rb_ary_new();
|
@@ -141,7 +149,8 @@
|
|
141
149
|
//// Manual wrappers
|
142
150
|
|
143
151
|
// Single get. SWIG likes to use SWIG_FromCharPtr instead of SWIG_FromCharPtrAndSize because
|
144
|
-
// of the retval/argout split, so it truncates return values with \0 in them.
|
152
|
+
// of the retval/argout split, so it truncates return values with \0 in them. There is probably a better
|
153
|
+
// way to do this.
|
145
154
|
VALUE memcached_get_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error);
|
146
155
|
%{
|
147
156
|
VALUE memcached_get_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error) {
|
@@ -193,20 +202,6 @@ VALUE memcached_fetch_rvalue(memcached_st *ptr, char *key, size_t *key_length, u
|
|
193
202
|
};
|
194
203
|
%}
|
195
204
|
|
196
|
-
// We need to wrap this so it doesn't leak memory. SWIG doesn't want to automatically free. We could
|
197
|
-
// maybe use a 'ret' %typemap, but this is ok.
|
198
|
-
VALUE memcached_stat_get_rvalue(memcached_st *ptr, memcached_stat_st *stat, char *key, memcached_return *error);
|
199
|
-
%{
|
200
|
-
VALUE memcached_stat_get_rvalue(memcached_st *ptr, memcached_stat_st *stat, char *key, memcached_return *error) {
|
201
|
-
char *str;
|
202
|
-
VALUE ret;
|
203
|
-
str = memcached_stat_get_value(ptr, stat, key, error);
|
204
|
-
ret = rb_str_new2(str);
|
205
|
-
free(str);
|
206
|
-
return ret;
|
207
|
-
};
|
208
|
-
%}
|
209
|
-
|
210
205
|
// Ruby isn't aware that the pointer is an array... there is probably a better way to do this
|
211
206
|
memcached_server_st *memcached_select_server_at(memcached_st *in_ptr, int index);
|
212
207
|
%{
|
data/ext/rlibmemcached_wrap.c
CHANGED
@@ -2294,16 +2294,6 @@ VALUE memcached_fetch_rvalue(memcached_st *ptr, char *key, size_t *key_length, u
|
|
2294
2294
|
};
|
2295
2295
|
|
2296
2296
|
|
2297
|
-
VALUE memcached_stat_get_rvalue(memcached_st *ptr, memcached_stat_st *stat, char *key, memcached_return *error) {
|
2298
|
-
char *str;
|
2299
|
-
VALUE ret;
|
2300
|
-
str = memcached_stat_get_value(ptr, stat, key, error);
|
2301
|
-
ret = rb_str_new2(str);
|
2302
|
-
free(str);
|
2303
|
-
return ret;
|
2304
|
-
};
|
2305
|
-
|
2306
|
-
|
2307
2297
|
memcached_server_st *memcached_select_server_at(memcached_st *in_ptr, int index) {
|
2308
2298
|
return &(in_ptr->hosts[index]);
|
2309
2299
|
};
|
@@ -6907,7 +6897,7 @@ _wrap_memcached_create(int argc, VALUE *argv, VALUE self) {
|
|
6907
6897
|
}
|
6908
6898
|
arg1 = (memcached_st *)(argp1);
|
6909
6899
|
result = (memcached_st *)memcached_create(arg1);
|
6910
|
-
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_memcached_st,
|
6900
|
+
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_memcached_st, SWIG_POINTER_OWN | 0 );
|
6911
6901
|
return vresult;
|
6912
6902
|
fail:
|
6913
6903
|
return Qnil;
|
@@ -6960,7 +6950,7 @@ _wrap_memcached_clone(int argc, VALUE *argv, VALUE self) {
|
|
6960
6950
|
}
|
6961
6951
|
arg2 = (memcached_st *)(argp2);
|
6962
6952
|
result = (memcached_st *)memcached_clone(arg1,arg2);
|
6963
|
-
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_memcached_st,
|
6953
|
+
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_memcached_st, SWIG_POINTER_OWN | 0 );
|
6964
6954
|
return vresult;
|
6965
6955
|
fail:
|
6966
6956
|
return Qnil;
|
@@ -8190,6 +8180,7 @@ _wrap_memcached_stat_get_value(int argc, VALUE *argv, VALUE self) {
|
|
8190
8180
|
vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_memcached_return, new_flags));
|
8191
8181
|
}
|
8192
8182
|
if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
|
8183
|
+
free((char*)result);
|
8193
8184
|
return vresult;
|
8194
8185
|
fail:
|
8195
8186
|
if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
|
@@ -9101,7 +9092,6 @@ _wrap_memcached_fetch(int argc, VALUE *argv, VALUE self) {
|
|
9101
9092
|
result = (char *)memcached_fetch(arg1,arg2,arg3,arg4,arg5,arg6);
|
9102
9093
|
vresult = SWIG_FromCharPtr((const char *)result);
|
9103
9094
|
{
|
9104
|
-
// Pushes an empty string when *key_length == 0
|
9105
9095
|
rb_ary_push(vresult, rb_str_new(arg2, *arg3));
|
9106
9096
|
}
|
9107
9097
|
if (SWIG_IsTmpObj(res4)) {
|
@@ -12064,7 +12054,7 @@ _wrap_memcached_server_by_key(int argc, VALUE *argv, VALUE self) {
|
|
12064
12054
|
arg3 = (size_t) RSTRING_LEN(argv[1]);
|
12065
12055
|
}
|
12066
12056
|
result = (memcached_server_st *)memcached_server_by_key(arg1,(char const *)arg2,arg3,arg4);
|
12067
|
-
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_memcached_server_st,
|
12057
|
+
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_memcached_server_st, SWIG_POINTER_OWN | 0 );
|
12068
12058
|
if (SWIG_IsTmpObj(res4)) {
|
12069
12059
|
vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_unsigned_SS_short((*arg4)));
|
12070
12060
|
} else {
|
@@ -12680,7 +12670,6 @@ _wrap_memcached_fetch_rvalue(int argc, VALUE *argv, VALUE self) {
|
|
12680
12670
|
result = (VALUE)memcached_fetch_rvalue(arg1,arg2,arg3,arg4,arg5);
|
12681
12671
|
vresult = result;
|
12682
12672
|
{
|
12683
|
-
// Pushes an empty string when *key_length == 0
|
12684
12673
|
rb_ary_push(vresult, rb_str_new(arg2, *arg3));
|
12685
12674
|
}
|
12686
12675
|
if (SWIG_IsTmpObj(res4)) {
|
@@ -12701,59 +12690,6 @@ fail:
|
|
12701
12690
|
}
|
12702
12691
|
|
12703
12692
|
|
12704
|
-
SWIGINTERN VALUE
|
12705
|
-
_wrap_memcached_stat_get_rvalue(int argc, VALUE *argv, VALUE self) {
|
12706
|
-
memcached_st *arg1 = (memcached_st *) 0 ;
|
12707
|
-
memcached_stat_st *arg2 = (memcached_stat_st *) 0 ;
|
12708
|
-
char *arg3 = (char *) 0 ;
|
12709
|
-
memcached_return *arg4 = (memcached_return *) 0 ;
|
12710
|
-
void *argp1 = 0 ;
|
12711
|
-
int res1 = 0 ;
|
12712
|
-
void *argp2 = 0 ;
|
12713
|
-
int res2 = 0 ;
|
12714
|
-
int res3 ;
|
12715
|
-
char *buf3 = 0 ;
|
12716
|
-
int alloc3 = 0 ;
|
12717
|
-
memcached_return temp4 ;
|
12718
|
-
int res4 = SWIG_TMPOBJ ;
|
12719
|
-
VALUE result;
|
12720
|
-
VALUE vresult = Qnil;
|
12721
|
-
|
12722
|
-
arg4 = &temp4;
|
12723
|
-
if ((argc < 3) || (argc > 3)) {
|
12724
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
|
12725
|
-
}
|
12726
|
-
res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_memcached_st, 0 | 0 );
|
12727
|
-
if (!SWIG_IsOK(res1)) {
|
12728
|
-
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "memcached_st *","memcached_stat_get_rvalue", 1, argv[0] ));
|
12729
|
-
}
|
12730
|
-
arg1 = (memcached_st *)(argp1);
|
12731
|
-
res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_memcached_stat_st, 0 | 0 );
|
12732
|
-
if (!SWIG_IsOK(res2)) {
|
12733
|
-
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "memcached_stat_st *","memcached_stat_get_rvalue", 2, argv[1] ));
|
12734
|
-
}
|
12735
|
-
arg2 = (memcached_stat_st *)(argp2);
|
12736
|
-
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
|
12737
|
-
if (!SWIG_IsOK(res3)) {
|
12738
|
-
SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char *","memcached_stat_get_rvalue", 3, argv[2] ));
|
12739
|
-
}
|
12740
|
-
arg3 = (char *)(buf3);
|
12741
|
-
result = (VALUE)memcached_stat_get_rvalue(arg1,arg2,arg3,arg4);
|
12742
|
-
vresult = result;
|
12743
|
-
if (SWIG_IsTmpObj(res4)) {
|
12744
|
-
vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_unsigned_SS_short((*arg4)));
|
12745
|
-
} else {
|
12746
|
-
int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
|
12747
|
-
vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_memcached_return, new_flags));
|
12748
|
-
}
|
12749
|
-
if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
|
12750
|
-
return vresult;
|
12751
|
-
fail:
|
12752
|
-
if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
|
12753
|
-
return Qnil;
|
12754
|
-
}
|
12755
|
-
|
12756
|
-
|
12757
12693
|
SWIGINTERN VALUE
|
12758
12694
|
_wrap_memcached_select_server_at(int argc, VALUE *argv, VALUE self) {
|
12759
12695
|
memcached_st *arg1 = (memcached_st *) 0 ;
|
@@ -13716,7 +13652,6 @@ SWIGEXPORT void Init_rlibmemcached(void) {
|
|
13716
13652
|
rb_define_module_function(mRlibmemcached, "memcached_get_len_rvalue", _wrap_memcached_get_len_rvalue, -1);
|
13717
13653
|
rb_define_module_function(mRlibmemcached, "memcached_get_from_last_rvalue", _wrap_memcached_get_from_last_rvalue, -1);
|
13718
13654
|
rb_define_module_function(mRlibmemcached, "memcached_fetch_rvalue", _wrap_memcached_fetch_rvalue, -1);
|
13719
|
-
rb_define_module_function(mRlibmemcached, "memcached_stat_get_rvalue", _wrap_memcached_stat_get_rvalue, -1);
|
13720
13655
|
rb_define_module_function(mRlibmemcached, "memcached_select_server_at", _wrap_memcached_select_server_at, -1);
|
13721
13656
|
rb_define_module_function(mRlibmemcached, "memcached_select_stat_at", _wrap_memcached_select_stat_at, -1);
|
13722
13657
|
rb_define_module_function(mRlibmemcached, "memcached_generate_hash_rvalue", _wrap_memcached_generate_hash_rvalue, -1);
|
data/lib/memcached/memcached.rb
CHANGED
@@ -223,12 +223,10 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
|
|
223
223
|
# object.
|
224
224
|
#
|
225
225
|
def clone
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
# memcached
|
231
|
-
self.class.new(servers, options.merge(:prefix_key => prefix_key))
|
226
|
+
memcached = super
|
227
|
+
struct = Lib.memcached_clone(nil, @struct)
|
228
|
+
memcached.instance_variable_set('@struct', struct)
|
229
|
+
memcached
|
232
230
|
end
|
233
231
|
|
234
232
|
# Reset the state of the libmemcached struct. This is useful for changing the server list at runtime.
|
@@ -561,7 +559,7 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
|
|
561
559
|
keys.each do |key|
|
562
560
|
server_structs.size.times do |index|
|
563
561
|
|
564
|
-
value, ret = Lib.
|
562
|
+
value, ret = Lib.memcached_stat_get_value(
|
565
563
|
@struct,
|
566
564
|
Lib.memcached_select_stat_at(@struct, stat_struct, index),
|
567
565
|
key)
|
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.1.
|
5
|
+
s.version = "1.1.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{2011-02-
|
10
|
+
s.date = %q{2011-02-27}
|
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/exercise.rb
CHANGED
@@ -97,10 +97,36 @@ class Worker
|
|
97
97
|
@cache.delete @key1
|
98
98
|
@cache.delete @key2
|
99
99
|
end
|
100
|
-
when "
|
100
|
+
when "everything"
|
101
101
|
@i.times do
|
102
|
-
@cache.
|
102
|
+
@cache.set @key1, @value
|
103
|
+
@cache.set @key2, @value
|
104
|
+
@cache.get @key1
|
105
|
+
@cache.get @key3
|
106
|
+
@cache.get [@key1, @key2, @key3]
|
107
|
+
@cache.prepend @key1, @marshalled
|
108
|
+
@cache.prepend @key2, @marshalled
|
109
|
+
@cache.delete @key1
|
110
|
+
@cache.delete @key2
|
111
|
+
@cache.prepend @key1, @marshalled
|
112
|
+
@cache.prepend @key2, @marshalled
|
113
|
+
@cache.get @key1
|
114
|
+
@cache.get @key3
|
115
|
+
cache = @cache.clone
|
116
|
+
servers = @cache.servers
|
117
|
+
server = @cache.server_by_key(@key1)
|
118
|
+
end
|
119
|
+
@i.times do
|
120
|
+
@cache.reset
|
103
121
|
end
|
122
|
+
system("killall -9 memcached")
|
123
|
+
@i.times do
|
124
|
+
@cache.set @key1, @value rescue nil
|
125
|
+
@cache.get @key3 rescue nil
|
126
|
+
@cache.delete @key2 rescue nil
|
127
|
+
end
|
128
|
+
when "stats"
|
129
|
+
@cache.stats
|
104
130
|
when "multiget"
|
105
131
|
@i.times do
|
106
132
|
@cache.get([@key1, @key2, @key3])
|
@@ -136,9 +162,9 @@ class Worker
|
|
136
162
|
ObjectSpace.each_object(Memcached) { clients += 1 }
|
137
163
|
ObjectSpace.each_object(Rlibmemcached::MemcachedSt) { sts += 1 }
|
138
164
|
ObjectSpace.each_object(Rlibmemcached::MemcachedServerSt) { server_sts += 1 }
|
139
|
-
puts "***
|
140
|
-
puts "***
|
141
|
-
puts "***
|
165
|
+
puts "*** memcached_st structs: #{sts} ***"
|
166
|
+
puts "*** memcached_server_st structs: #{server_sts} ***"
|
167
|
+
puts "*** Memcached instances: #{clients} ***"
|
142
168
|
|
143
169
|
begin;
|
144
170
|
require 'memory'
|
data/test/profile/valgrind.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
require "#{File.dirname(__FILE__)}/../setup"
|
2
2
|
|
3
|
-
exec("valgrind --tool=memcheck --error-limit=no --leak-check=full --show-reachable=no --num-callers=15 --track-fds=yes --workaround-gcc296-bugs=yes --max-stackframe=7304328 --dsymutil=yes
|
3
|
+
exec("valgrind --tool=memcheck --error-limit=no --undef-value-errors=no --leak-check=full --show-reachable=no --num-callers=15 --track-fds=yes --workaround-gcc296-bugs=yes --leak-resolution=med --max-stackframe=7304328 --dsymutil=yes ruby -r#{File.dirname(__FILE__)}/exercise.rb -e \"Worker.new(ENV['TEST'] || 'everything', 50, 'true').work\"")
|
data/test/test_helper.rb
CHANGED
@@ -1,18 +1,16 @@
|
|
1
1
|
|
2
2
|
$LOAD_PATH << "#{File.dirname(__FILE__)}/../lib"
|
3
3
|
|
4
|
-
require 'rubygems'
|
5
|
-
require 'mocha'
|
6
4
|
require 'socket'
|
7
5
|
require 'benchmark'
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
|
7
|
+
require 'rubygems'
|
8
|
+
require 'ruby-debug' if ENV['DEBUG']
|
13
9
|
require 'memcached'
|
10
|
+
|
14
11
|
require 'test/unit'
|
15
12
|
require 'ostruct'
|
13
|
+
require 'mocha'
|
16
14
|
|
17
15
|
UNIX_SOCKET_NAME = File.join(ENV['TMPDIR']||'/tmp','memcached') unless defined? UNIX_SOCKET_NAME
|
18
16
|
|
data/test/unit/memcached_test.rb
CHANGED
@@ -20,7 +20,6 @@ class MemcachedTest < Test::Unit::TestCase
|
|
20
20
|
:prefix_key => @prefix_key,
|
21
21
|
:hash => :default,
|
22
22
|
:distribution => :modula,
|
23
|
-
# binary_protocol does not work -- test_get, test_get, test_append, and test_missing_append will fail when it is set to true.
|
24
23
|
:binary_protocol => true}
|
25
24
|
@binary_protocol_cache = Memcached.new(@servers, @binary_protocol_options)
|
26
25
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memcached
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 3
|
10
|
+
version: 1.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Evan Weaver
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
yZ0=
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2011-02-
|
39
|
+
date: 2011-02-27 00:00:00 -08:00
|
40
40
|
default_executable:
|
41
41
|
dependencies: []
|
42
42
|
|
metadata.gz.sig
CHANGED
Binary file
|