memcached 0.20.0 → 0.20.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,5 +1,7 @@
1
1
 
2
- v0.20.0. Add experimental module, with get_len() operator.
2
+ v0.20.1. Better module naming. Oops.
3
+
4
+ v0.20.0. Add experimental module, with get_len() operator (rgbenson).
3
5
 
4
6
  v0.19.10. Add no-op hash (MEMCACHED_HASH_NONE) to skip hashing when there is one server (bierbaum). Updated benchmark.
5
7
 
data/Manifest CHANGED
@@ -19,7 +19,7 @@ lib/memcached.rb
19
19
  lib/memcached/auth.rb
20
20
  lib/memcached/behaviors.rb
21
21
  lib/memcached/exceptions.rb
22
- lib/memcached/experimental_memcached.rb
22
+ lib/memcached/experimental.rb
23
23
  lib/memcached/integer.rb
24
24
  lib/memcached/memcached.rb
25
25
  lib/memcached/rails.rb
@@ -30,4 +30,4 @@ require 'memcached/behaviors'
30
30
  require 'memcached/auth'
31
31
  require 'memcached/memcached'
32
32
  require 'memcached/rails'
33
- require 'memcached/experimental_memcached'
33
+ require 'memcached/experimental'
@@ -0,0 +1,35 @@
1
+ class Memcached
2
+ module Experimental
3
+
4
+ def get_len(bytes, keys)
5
+ if keys.is_a? ::Array
6
+ # Multi get
7
+ ret = Lib.memcached_mget_len(@struct, keys, bytes);
8
+ check_return_code(ret, keys)
9
+
10
+ hash = {}
11
+ keys.each do
12
+ value, key, flags, ret = Lib.memcached_fetch_rvalue(@struct)
13
+ break if ret == Lib::MEMCACHED_END
14
+ if ret != Lib::MEMCACHED_NOTFOUND
15
+ check_return_code(ret, key)
16
+ # Assign the value
17
+ hash[key] = value
18
+ end
19
+ end
20
+ hash
21
+ else
22
+ # Single get_len
23
+ value, flags, ret = Lib.memcached_get_len_rvalue(@struct, keys, bytes)
24
+ check_return_code(ret, keys)
25
+ value
26
+ end
27
+ rescue => e
28
+ tries ||= 0
29
+ raise unless tries < options[:exception_retry_limit] && should_retry(e)
30
+ tries += 1
31
+ retry
32
+ end
33
+
34
+ end
35
+ end
@@ -119,10 +119,8 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
119
119
  options[:credentials] = [ENV["MEMCACHE_USERNAME"], ENV["MEMCACHE_PASSWORD"]]
120
120
  end
121
121
 
122
- if options[:experimental_features]
123
- instance_eval { send(:extend, ::ExperimentalMemcached) }
124
- end
125
-
122
+ instance_eval { send(:extend, Experimental) } if options[:experimental_features]
123
+
126
124
  options[:binary_protocol] = true if options[:credentials] != nil
127
125
 
128
126
  # Force :buffer_requests to use :no_block
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{memcached}
5
- s.version = "0.20.0"
5
+ s.version = "0.20.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"]
@@ -11,8 +11,8 @@ Gem::Specification.new do |s|
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/experimental_memcached.rb", "lib/memcached/memcached.rb", "lib/memcached/rails.rb"]
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_memcached.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"]
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"]
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"]
18
18
  s.require_paths = ["lib", "ext"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 20
8
- - 0
9
- version: 0.20.0
8
+ - 1
9
+ version: 0.20.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Evan Weaver
@@ -54,7 +54,6 @@ extra_rdoc_files:
54
54
  - lib/memcached.rb
55
55
  - lib/memcached/behaviors.rb
56
56
  - lib/memcached/exceptions.rb
57
- - lib/memcached/experimental_memcached.rb
58
57
  - lib/memcached/memcached.rb
59
58
  - lib/memcached/rails.rb
60
59
  files:
@@ -79,7 +78,7 @@ files:
79
78
  - lib/memcached/auth.rb
80
79
  - lib/memcached/behaviors.rb
81
80
  - lib/memcached/exceptions.rb
82
- - lib/memcached/experimental_memcached.rb
81
+ - lib/memcached/experimental.rb
83
82
  - lib/memcached/integer.rb
84
83
  - lib/memcached/memcached.rb
85
84
  - lib/memcached/rails.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,31 +0,0 @@
1
- module ExperimentalMemcached
2
- def get_len(user_spec_len, keys)
3
- if keys.is_a? ::Array
4
- # Multi get
5
- ret = ::Memcached::Lib.memcached_mget_len(@struct, keys, user_spec_len);
6
- check_return_code(ret, keys)
7
-
8
- hash = {}
9
- keys.each do
10
- value, key, flags, ret = ::Memcached::Lib.memcached_fetch_rvalue(@struct)
11
- break if ret == ::Memcached::Lib::MEMCACHED_END
12
- if ret != ::Memcached::Lib::MEMCACHED_NOTFOUND
13
- check_return_code(ret, key)
14
- # Assign the value
15
- hash[key] = value
16
- end
17
- end
18
- hash
19
- else
20
- # Single get_len
21
- value, flags, ret = ::Memcached::Lib.memcached_get_len_rvalue(@struct, keys, user_spec_len)
22
- check_return_code(ret, keys)
23
- value
24
- end
25
- rescue => e
26
- tries ||= 0
27
- raise unless tries < options[:exception_retry_limit] && should_retry(e)
28
- tries += 1
29
- retry
30
- end
31
- end