From 9b8ef6c244fbbb5758971b33a926ab352d943f8b Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Thu, 22 Aug 2019 16:04:14 -0700 Subject: [PATCH 1/3] Add support for pooled memcached clients by using #with --- lib/suo/client/memcached.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/suo/client/memcached.rb b/lib/suo/client/memcached.rb index b827074..dbc74b8 100644 --- a/lib/suo/client/memcached.rb +++ b/lib/suo/client/memcached.rb @@ -7,27 +7,29 @@ def initialize(key, options = {}) end def clear - @client.delete(@key) + @client.with { |client| client.delete(@key) } end private def get - @client.get_cas(@key) + @client.with { |client| client.get_cas(@key) } end def set(newval, cas, expire: false) if expire - @client.set_cas(@key, newval, cas, @options[:ttl]) + @client.with { |client| client.set_cas(@key, newval, cas, @options[:ttl]) } else - @client.set_cas(@key, newval, cas) + @client.with { |client| client.set_cas(@key, newval, cas) } end end def initial_set(val = BLANK_STR) - @client.set(@key, val) - _val, cas = @client.get_cas(@key) - cas + @client.with do |client| + client.set(@key, val) + _val, cas = client.get_cas(@key) + cas + end end end end From ad08c8b5ea34a27556961b82745c5c5184e08f1b Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Thu, 22 Aug 2019 16:14:01 -0700 Subject: [PATCH 2/3] bump Bundler to 2 --- suo.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/suo.gemspec b/suo.gemspec index a2352d0..190c1ae 100644 --- a/suo.gemspec +++ b/suo.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |spec| spec.add_dependency "redis" spec.add_dependency "msgpack" - spec.add_development_dependency "bundler", "~> 1.5" + spec.add_development_dependency "bundler", "~> 2" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rubocop", "~> 0.49.0" spec.add_development_dependency "minitest", "~> 5.5.0" From 60e167e146dd9673b28c74059c7fc2c94affe7dd Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Thu, 22 Aug 2019 16:16:57 -0700 Subject: [PATCH 3/3] relax bundler dependency version --- suo.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/suo.gemspec b/suo.gemspec index 190c1ae..80c3b0d 100644 --- a/suo.gemspec +++ b/suo.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |spec| spec.add_dependency "redis" spec.add_dependency "msgpack" - spec.add_development_dependency "bundler", "~> 2" + spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rubocop", "~> 0.49.0" spec.add_development_dependency "minitest", "~> 5.5.0"