memcached 1.1.3 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +2 -0
- data/Manifest +1 -1
- data/README +2 -6
- data/ext/extconf.rb +4 -8
- data/ext/libmemcached-7.patch +2989 -0
- data/ext/rlibmemcached_wrap.c +0 -64
- data/lib/memcached/memcached.rb +7 -21
- data/lib/memcached/rails.rb +11 -3
- data/memcached.gemspec +4 -4
- data/test/unit/memcached_test.rb +22 -17
- data/test/unit/rails_test.rb +23 -15
- metadata +6 -7
- metadata.gz.sig +0 -0
- data/lib/rlibmemcached.bundle.dSYM/Contents/Info.plist +0 -20
data/ext/rlibmemcached_wrap.c
CHANGED
@@ -6466,67 +6466,6 @@ fail:
|
|
6466
6466
|
}
|
6467
6467
|
|
6468
6468
|
|
6469
|
-
SWIGINTERN VALUE
|
6470
|
-
_wrap_MemcachedSt_number_of_replicas_set(int argc, VALUE *argv, VALUE self) {
|
6471
|
-
struct memcached_st *arg1 = (struct memcached_st *) 0 ;
|
6472
|
-
uint32_t arg2 ;
|
6473
|
-
void *argp1 = 0 ;
|
6474
|
-
int res1 = 0 ;
|
6475
|
-
void *argp2 ;
|
6476
|
-
int res2 = 0 ;
|
6477
|
-
|
6478
|
-
if ((argc < 1) || (argc > 1)) {
|
6479
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
|
6480
|
-
}
|
6481
|
-
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_memcached_st, 0 | 0 );
|
6482
|
-
if (!SWIG_IsOK(res1)) {
|
6483
|
-
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct memcached_st *","number_of_replicas", 1, self ));
|
6484
|
-
}
|
6485
|
-
arg1 = (struct memcached_st *)(argp1);
|
6486
|
-
{
|
6487
|
-
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_uint32_t, 0 );
|
6488
|
-
if (!SWIG_IsOK(res2)) {
|
6489
|
-
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "uint32_t","number_of_replicas", 2, argv[0] ));
|
6490
|
-
}
|
6491
|
-
if (!argp2) {
|
6492
|
-
SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "uint32_t","number_of_replicas", 2, argv[0]));
|
6493
|
-
} else {
|
6494
|
-
arg2 = *((uint32_t *)(argp2));
|
6495
|
-
}
|
6496
|
-
}
|
6497
|
-
if (arg1) (arg1)->number_of_replicas = arg2;
|
6498
|
-
return Qnil;
|
6499
|
-
fail:
|
6500
|
-
return Qnil;
|
6501
|
-
}
|
6502
|
-
|
6503
|
-
|
6504
|
-
SWIGINTERN VALUE
|
6505
|
-
_wrap_MemcachedSt_number_of_replicas_get(int argc, VALUE *argv, VALUE self) {
|
6506
|
-
struct memcached_st *arg1 = (struct memcached_st *) 0 ;
|
6507
|
-
void *argp1 = 0 ;
|
6508
|
-
int res1 = 0 ;
|
6509
|
-
uint32_t result;
|
6510
|
-
VALUE vresult = Qnil;
|
6511
|
-
|
6512
|
-
if ((argc < 0) || (argc > 0)) {
|
6513
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
|
6514
|
-
}
|
6515
|
-
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_memcached_st, 0 | 0 );
|
6516
|
-
if (!SWIG_IsOK(res1)) {
|
6517
|
-
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct memcached_st *","number_of_replicas", 1, self ));
|
6518
|
-
}
|
6519
|
-
arg1 = (struct memcached_st *)(argp1);
|
6520
|
-
result = ((arg1)->number_of_replicas);
|
6521
|
-
{
|
6522
|
-
vresult = UINT2NUM(result);
|
6523
|
-
}
|
6524
|
-
return vresult;
|
6525
|
-
fail:
|
6526
|
-
return Qnil;
|
6527
|
-
}
|
6528
|
-
|
6529
|
-
|
6530
6469
|
SWIGINTERN VALUE
|
6531
6470
|
_wrap_MemcachedSt_number_of_live_hosts_set(int argc, VALUE *argv, VALUE self) {
|
6532
6471
|
struct memcached_st *arg1 = (struct memcached_st *) 0 ;
|
@@ -13350,8 +13289,6 @@ SWIGEXPORT void Init_rlibmemcached(void) {
|
|
13350
13289
|
rb_define_method(SwigClassMemcachedSt.klass, "delete_trigger", _wrap_MemcachedSt_delete_trigger_get, -1);
|
13351
13290
|
rb_define_method(SwigClassMemcachedSt.klass, "prefix_key=", _wrap_MemcachedSt_prefix_key_set, -1);
|
13352
13291
|
rb_define_method(SwigClassMemcachedSt.klass, "prefix_key", _wrap_MemcachedSt_prefix_key_get, -1);
|
13353
|
-
rb_define_method(SwigClassMemcachedSt.klass, "number_of_replicas=", _wrap_MemcachedSt_number_of_replicas_set, -1);
|
13354
|
-
rb_define_method(SwigClassMemcachedSt.klass, "number_of_replicas", _wrap_MemcachedSt_number_of_replicas_get, -1);
|
13355
13292
|
rb_define_method(SwigClassMemcachedSt.klass, "number_of_live_hosts=", _wrap_MemcachedSt_number_of_live_hosts_set, -1);
|
13356
13293
|
rb_define_method(SwigClassMemcachedSt.klass, "number_of_live_hosts", _wrap_MemcachedSt_number_of_live_hosts_get, -1);
|
13357
13294
|
rb_define_method(SwigClassMemcachedSt.klass, "live_host_indices=", _wrap_MemcachedSt_live_host_indices_set, -1);
|
@@ -13498,7 +13435,6 @@ SWIGEXPORT void Init_rlibmemcached(void) {
|
|
13498
13435
|
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_NOREPLY", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_NOREPLY)));
|
13499
13436
|
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_USE_UDP", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_USE_UDP)));
|
13500
13437
|
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS)));
|
13501
|
-
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS)));
|
13502
13438
|
rb_define_const(mRlibmemcached, "MEMCACHED_CALLBACK_PREFIX_KEY", SWIG_From_int((int)(MEMCACHED_CALLBACK_PREFIX_KEY)));
|
13503
13439
|
rb_define_const(mRlibmemcached, "MEMCACHED_CALLBACK_USER_DATA", SWIG_From_int((int)(MEMCACHED_CALLBACK_USER_DATA)));
|
13504
13440
|
rb_define_const(mRlibmemcached, "MEMCACHED_CALLBACK_CLEANUP_FUNCTION", SWIG_From_int((int)(MEMCACHED_CALLBACK_CLEANUP_FUNCTION)));
|
data/lib/memcached/memcached.rb
CHANGED
@@ -70,7 +70,7 @@ Weights only affect Ketama hashing. If you use Ketama hashing and don't specify
|
|
70
70
|
Valid option parameters are:
|
71
71
|
|
72
72
|
<tt>:prefix_key</tt>:: A string to prepend to every key, for namespacing. Max length is 127. Defaults to the empty string.
|
73
|
-
<tt>:prefix_delimiter</tt>:: A character to
|
73
|
+
<tt>:prefix_delimiter</tt>:: A character to append to the prefix key. Defaults to the empty string.
|
74
74
|
<tt>:hash</tt>:: The name of a hash function to use. Possible values are: <tt>:crc</tt>, <tt>:default</tt>, <tt>:fnv1_32</tt>, <tt>:fnv1_64</tt>, <tt>:fnv1a_32</tt>, <tt>:fnv1a_64</tt>, <tt>:hsieh</tt>, <tt>:md5</tt>, <tt>:murmur</tt>, and <tt>:none</tt>. <tt>:fnv1_32</tt> is fast and well known, and is the default. Use <tt>:md5</tt> for compatibility with other ketama clients. <tt>:none</tt> is for use when there is a single server, and performs no actual hashing.
|
75
75
|
<tt>:distribution</tt>:: Either <tt>:modula</tt>, <tt>:consistent_ketama</tt>, <tt>:consistent_wheel</tt>, or <tt>:ketama</tt>. Defaults to <tt>:ketama</tt>.
|
76
76
|
<tt>:server_failure_limit</tt>:: How many consecutive failures to allow before marking a host as dead. Has no effect unless <tt>:retry_timeout</tt> is also set.
|
@@ -141,7 +141,7 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
|
|
141
141
|
options[:poll_timeout] ||= options[:timeout] || 0
|
142
142
|
|
143
143
|
# Set the prefix key. Support the legacy name.
|
144
|
-
set_prefix_key(options
|
144
|
+
set_prefix_key(options[:prefix_key] || options[:namespace])
|
145
145
|
|
146
146
|
# Set the behaviors and credentials on the struct
|
147
147
|
set_behaviors
|
@@ -213,7 +213,11 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
|
|
213
213
|
|
214
214
|
# Return the current prefix key.
|
215
215
|
def prefix_key
|
216
|
-
|
216
|
+
if @struct.prefix_key.size > 0
|
217
|
+
@struct.prefix_key[0..-1 - options[:prefix_delimiter].size]
|
218
|
+
else
|
219
|
+
""
|
220
|
+
end
|
217
221
|
end
|
218
222
|
alias :namespace :prefix_key
|
219
223
|
|
@@ -260,24 +264,6 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
|
|
260
264
|
alias :dup :clone #:nodoc:
|
261
265
|
#:startdoc:
|
262
266
|
|
263
|
-
# change the prefix_key after we're in motion
|
264
|
-
def prefix_key=(key)
|
265
|
-
unless key.size < Lib::MEMCACHED_PREFIX_KEY_MAX_SIZE
|
266
|
-
raise ArgumentError, "Max prefix_key size is #{Lib::MEMCACHED_PREFIX_KEY_MAX_SIZE - 1}"
|
267
|
-
end
|
268
|
-
check_return_code(
|
269
|
-
Lib.memcached_callback_set(@struct, Lib::MEMCACHED_CALLBACK_PREFIX_KEY, "#{key}#{options[:prefix_delimiter]}")
|
270
|
-
)
|
271
|
-
end
|
272
|
-
alias namespace= prefix_key=
|
273
|
-
|
274
|
-
# report the prefix_key
|
275
|
-
def prefix_key
|
276
|
-
@struct.prefix_key[0..-1 - options[:prefix_delimiter].size]
|
277
|
-
end
|
278
|
-
alias namespace prefix_key
|
279
|
-
|
280
|
-
|
281
267
|
### Configuration helpers
|
282
268
|
|
283
269
|
private
|
data/lib/memcached/rails.rb
CHANGED
@@ -26,7 +26,7 @@ class Memcached
|
|
26
26
|
opts[:prefix_key] ||= opts[:namespace]
|
27
27
|
@logger = opts[:logger]
|
28
28
|
@string_return_types = opts[:string_return_types]
|
29
|
-
|
29
|
+
|
30
30
|
logger.info { "memcached #{VERSION} #{servers.inspect}" } if logger
|
31
31
|
super(servers, opts)
|
32
32
|
end
|
@@ -48,6 +48,14 @@ class Memcached
|
|
48
48
|
get(key, options[:raw])
|
49
49
|
end
|
50
50
|
|
51
|
+
# Returns whether the key exists, even if the value is nil.
|
52
|
+
def exist?(key, options = {})
|
53
|
+
get_orig(key, options)
|
54
|
+
true
|
55
|
+
rescue NotFound
|
56
|
+
false
|
57
|
+
end
|
58
|
+
|
51
59
|
# Wraps Memcached#cas so that it doesn't raise. Doesn't set anything if no value is present.
|
52
60
|
def cas(key, ttl=@default_ttl, raw=false, &block)
|
53
61
|
super(key, ttl, !raw, &block)
|
@@ -71,7 +79,7 @@ class Memcached
|
|
71
79
|
false
|
72
80
|
end
|
73
81
|
|
74
|
-
# Alternative to #set. Accepts a key, value, and an optional options hash supporting the
|
82
|
+
# Alternative to #set. Accepts a key, value, and an optional options hash supporting the
|
75
83
|
# options :raw and :ttl.
|
76
84
|
def write(key, value, options = {})
|
77
85
|
set(key, value, options[:ttl] || @default_ttl, options[:raw])
|
@@ -122,4 +130,4 @@ class Memcached
|
|
122
130
|
alias :"[]=" :set
|
123
131
|
|
124
132
|
end
|
125
|
-
end
|
133
|
+
end
|
data/memcached.gemspec
CHANGED
@@ -2,22 +2,22 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{memcached}
|
5
|
-
s.version = "1.
|
5
|
+
s.version = "1.2"
|
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-03-02}
|
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", "
|
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-7.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/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
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}
|
20
|
-
s.rubygems_version = %q{1.
|
20
|
+
s.rubygems_version = %q{1.6.0}
|
21
21
|
s.signing_key = %q{/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-private_key.pem}
|
22
22
|
s.summary = %q{An interface to the libmemcached C client.}
|
23
23
|
s.test_files = ["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"]
|
data/test/unit/memcached_test.rb
CHANGED
@@ -13,21 +13,24 @@ class MemcachedTest < Test::Unit::TestCase
|
|
13
13
|
@options = {
|
14
14
|
:prefix_key => @prefix_key,
|
15
15
|
:hash => :default,
|
16
|
-
:distribution => :modula
|
16
|
+
:distribution => :modula,
|
17
|
+
:show_backtraces => true}
|
17
18
|
@cache = Memcached.new(@servers, @options)
|
18
19
|
|
19
20
|
@binary_protocol_options = {
|
20
21
|
:prefix_key => @prefix_key,
|
21
22
|
:hash => :default,
|
22
23
|
:distribution => :modula,
|
23
|
-
:binary_protocol => true
|
24
|
+
:binary_protocol => true,
|
25
|
+
:show_backtraces => true}
|
24
26
|
@binary_protocol_cache = Memcached.new(@servers, @binary_protocol_options)
|
25
27
|
|
26
28
|
@udp_options = {
|
27
29
|
:prefix_key => @prefix_key,
|
28
30
|
:hash => :default,
|
29
31
|
:use_udp => true,
|
30
|
-
:distribution => :modula
|
32
|
+
:distribution => :modula,
|
33
|
+
:show_backtraces => true}
|
31
34
|
@udp_cache = Memcached.new(@udp_servers, @udp_options)
|
32
35
|
|
33
36
|
@noblock_options = {
|
@@ -36,7 +39,8 @@ class MemcachedTest < Test::Unit::TestCase
|
|
36
39
|
:noreply => true,
|
37
40
|
:buffer_requests => true,
|
38
41
|
:hash => :default,
|
39
|
-
:distribution => :modula
|
42
|
+
:distribution => :modula,
|
43
|
+
:show_backtraces => true}
|
40
44
|
@noblock_cache = Memcached.new(@servers, @noblock_options)
|
41
45
|
|
42
46
|
@value = OpenStruct.new(:a => 1, :b => 2, :c => GenericClass)
|
@@ -128,26 +132,25 @@ class MemcachedTest < Test::Unit::TestCase
|
|
128
132
|
|
129
133
|
def test_initialize_without_prefix_key
|
130
134
|
cache = Memcached.new @servers
|
131
|
-
assert_equal nil, cache.options[:prefix_key]
|
132
135
|
assert_equal 3, cache.send(:server_structs).size
|
133
136
|
end
|
134
137
|
|
135
138
|
def test_set_prefix_key
|
136
139
|
cache = Memcached.new @servers, :prefix_key => "foo"
|
137
|
-
cache.
|
140
|
+
cache.set_prefix_key("bar")
|
138
141
|
assert_equal "bar", cache.prefix_key
|
139
142
|
end
|
140
143
|
|
141
144
|
def test_set_prefix_key_to_empty_string
|
142
145
|
cache = Memcached.new @servers, :prefix_key => "foo"
|
143
|
-
cache.
|
146
|
+
cache.set_prefix_key("")
|
144
147
|
assert_equal "", cache.prefix_key
|
145
148
|
end
|
146
149
|
|
147
150
|
def test_memcached_callback_set_with_empty_string_should_not_raise_exception
|
148
151
|
cache = Memcached.new @servers, :prefix_key => "foo"
|
149
152
|
assert_nothing_raised do
|
150
|
-
cache.
|
153
|
+
cache.set_prefix_key("")
|
151
154
|
end
|
152
155
|
end
|
153
156
|
|
@@ -221,7 +224,6 @@ class MemcachedTest < Test::Unit::TestCase
|
|
221
224
|
|
222
225
|
def test_initialize_single_server
|
223
226
|
cache = Memcached.new 'localhost:43042'
|
224
|
-
assert_equal nil, cache.options[:prefix_key]
|
225
227
|
assert_equal 1, cache.send(:server_structs).size
|
226
228
|
end
|
227
229
|
|
@@ -233,12 +235,8 @@ class MemcachedTest < Test::Unit::TestCase
|
|
233
235
|
|
234
236
|
def test_get
|
235
237
|
@cache.set key, @value
|
236
|
-
|
237
|
-
assert_equal @value,
|
238
|
-
|
239
|
-
@binary_protocol_cache.set key, @value
|
240
|
-
result = @binary_protocol_cache.get key
|
241
|
-
assert_equal @value, result
|
238
|
+
assert_equal @value, @cache.get(key)
|
239
|
+
assert_equal @value, @binary_protocol_cache.get(key)
|
242
240
|
|
243
241
|
@udp_cache.set(key, @value)
|
244
242
|
assert_raises(Memcached::ActionNotSupported) do
|
@@ -518,6 +516,12 @@ class MemcachedTest < Test::Unit::TestCase
|
|
518
516
|
assert_raise(Memcached::NotFound) do
|
519
517
|
@cache.get key
|
520
518
|
end
|
519
|
+
|
520
|
+
@binary_protocol_cache.set key, @value
|
521
|
+
@binary_protocol_cache.delete key
|
522
|
+
assert_raise(Memcached::NotFound) do
|
523
|
+
@binary_protocol_cache.get key
|
524
|
+
end
|
521
525
|
end
|
522
526
|
|
523
527
|
def test_missing_delete
|
@@ -818,7 +822,7 @@ class MemcachedTest < Test::Unit::TestCase
|
|
818
822
|
end
|
819
823
|
end
|
820
824
|
|
821
|
-
#
|
825
|
+
# Pipelined, non-blocking IO
|
822
826
|
|
823
827
|
def test_buffered_requests_return_value
|
824
828
|
cache = Memcached.new @servers,
|
@@ -867,9 +871,10 @@ class MemcachedTest < Test::Unit::TestCase
|
|
867
871
|
end
|
868
872
|
|
869
873
|
def test_no_block_missing_delete
|
870
|
-
|
874
|
+
@noblock_cache.delete key rescue nil
|
871
875
|
assert_nothing_raised do
|
872
876
|
@noblock_cache.delete key
|
877
|
+
@noblock_cache.delete key
|
873
878
|
end
|
874
879
|
end
|
875
880
|
|
data/test/unit/rails_test.rb
CHANGED
@@ -16,21 +16,29 @@ class RailsTest < Test::Unit::TestCase
|
|
16
16
|
result = @cache.get key
|
17
17
|
assert_equal @value, result
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
|
+
def test_exist
|
21
|
+
assert !@cache.exist?(key)
|
22
|
+
@cache.set key, nil
|
23
|
+
assert @cache.exist?(key)
|
24
|
+
@cache.set key, @value
|
25
|
+
assert @cache.exist?(key)
|
26
|
+
end
|
27
|
+
|
20
28
|
def test_get_multi
|
21
29
|
@cache.set key, @value
|
22
30
|
assert_equal(
|
23
|
-
{key => @value},
|
31
|
+
{key => @value},
|
24
32
|
@cache.get_multi([key]))
|
25
33
|
end
|
26
34
|
|
27
35
|
def test_get_multi_empty_string
|
28
36
|
@cache.set key, "", 0, true
|
29
37
|
assert_equal(
|
30
|
-
{key => ""},
|
38
|
+
{key => ""},
|
31
39
|
@cache.get_multi([key], true))
|
32
40
|
end
|
33
|
-
|
41
|
+
|
34
42
|
def test_delete
|
35
43
|
@cache.set key, @value
|
36
44
|
assert_nothing_raised do
|
@@ -38,7 +46,7 @@ class RailsTest < Test::Unit::TestCase
|
|
38
46
|
end
|
39
47
|
assert_nil(@cache.get(key))
|
40
48
|
end
|
41
|
-
|
49
|
+
|
42
50
|
def test_delete_missing
|
43
51
|
assert_nothing_raised do
|
44
52
|
@cache.delete key
|
@@ -58,7 +66,7 @@ class RailsTest < Test::Unit::TestCase
|
|
58
66
|
result = @cache[key]
|
59
67
|
assert_equal @value, result
|
60
68
|
end
|
61
|
-
|
69
|
+
|
62
70
|
def test_cas
|
63
71
|
cache = Memcached::Rails.new(:servers => @servers, :namespace => @namespace, :support_cas => true)
|
64
72
|
value2 = OpenStruct.new(:d => 3, :e => 4, :f => GenericClass)
|
@@ -87,28 +95,28 @@ class RailsTest < Test::Unit::TestCase
|
|
87
95
|
current
|
88
96
|
end
|
89
97
|
end
|
90
|
-
end
|
91
|
-
|
98
|
+
end
|
99
|
+
|
92
100
|
def test_get_missing
|
93
101
|
@cache.delete key rescue nil
|
94
102
|
result = @cache.get key
|
95
103
|
assert_equal nil, result
|
96
|
-
end
|
97
|
-
|
104
|
+
end
|
105
|
+
|
98
106
|
def test_get_nil
|
99
107
|
@cache.set key, nil, 0
|
100
108
|
result = @cache.get key
|
101
109
|
assert_equal nil, result
|
102
|
-
end
|
103
|
-
|
110
|
+
end
|
111
|
+
|
104
112
|
def test_namespace
|
105
113
|
assert_equal @namespace, @cache.namespace
|
106
114
|
end
|
107
115
|
|
108
116
|
private
|
109
|
-
|
117
|
+
|
110
118
|
def key
|
111
119
|
caller.first[/.*[` ](.*)'/, 1] # '
|
112
120
|
end
|
113
|
-
|
114
|
-
end
|
121
|
+
|
122
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memcached
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 1.1.3
|
8
|
+
- 2
|
9
|
+
version: "1.2"
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Evan Weaver
|
@@ -36,7 +35,7 @@ cert_chain:
|
|
36
35
|
yZ0=
|
37
36
|
-----END CERTIFICATE-----
|
38
37
|
|
39
|
-
date: 2011-02
|
38
|
+
date: 2011-03-02 00:00:00 -08:00
|
40
39
|
default_executable:
|
41
40
|
dependencies: []
|
42
41
|
|
@@ -74,6 +73,7 @@ files:
|
|
74
73
|
- ext/libmemcached-4.patch
|
75
74
|
- ext/libmemcached-5.patch
|
76
75
|
- ext/libmemcached-6.patch
|
76
|
+
- ext/libmemcached-7.patch
|
77
77
|
- ext/libmemcached.patch
|
78
78
|
- ext/rlibmemcached.i
|
79
79
|
- ext/rlibmemcached_wrap.c
|
@@ -85,7 +85,6 @@ files:
|
|
85
85
|
- lib/memcached/experimental.rb
|
86
86
|
- lib/memcached/memcached.rb
|
87
87
|
- lib/memcached/rails.rb
|
88
|
-
- lib/rlibmemcached.bundle.dSYM/Contents/Info.plist
|
89
88
|
- test/profile/benchmark.rb
|
90
89
|
- test/profile/c_profiler.rb
|
91
90
|
- test/profile/exercise.rb
|
@@ -136,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
135
|
requirements: []
|
137
136
|
|
138
137
|
rubyforge_project: fauna
|
139
|
-
rubygems_version: 1.
|
138
|
+
rubygems_version: 1.6.0
|
140
139
|
signing_key:
|
141
140
|
specification_version: 3
|
142
141
|
summary: An interface to the libmemcached C client.
|