dalli 2.7.4 → 2.7.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of dalli might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +0 -7
- data/History.md +15 -0
- data/LICENSE +1 -1
- data/README.md +14 -6
- data/lib/active_support/cache/dalli_store.rb +39 -9
- data/lib/dalli/client.rb +40 -27
- data/lib/dalli/server.rb +33 -18
- data/lib/dalli/socket.rb +14 -4
- data/lib/dalli/version.rb +1 -1
- metadata +79 -43
- data/Performance.md +0 -42
- data/Rakefile +0 -43
- data/dalli.gemspec +0 -29
- data/test/benchmark_test.rb +0 -243
- data/test/helper.rb +0 -56
- data/test/memcached_mock.rb +0 -201
- data/test/sasl/memcached.conf +0 -1
- data/test/sasl/sasldb +0 -1
- data/test/test_active_support.rb +0 -541
- data/test/test_cas_client.rb +0 -107
- data/test/test_compressor.rb +0 -52
- data/test/test_dalli.rb +0 -682
- data/test/test_encoding.rb +0 -32
- data/test/test_failover.rb +0 -137
- data/test/test_network.rb +0 -64
- data/test/test_rack_session.rb +0 -341
- data/test/test_ring.rb +0 -85
- data/test/test_sasl.rb +0 -105
- data/test/test_serializer.rb +0 -29
- data/test/test_server.rb +0 -110
data/lib/dalli/socket.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
require 'rbconfig'
|
2
2
|
|
3
|
+
module Dalli::Server::TCPSocketOptions
|
4
|
+
def setsockopts(sock, options)
|
5
|
+
sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, true)
|
6
|
+
sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true) if options[:keepalive]
|
7
|
+
sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF, options[:rcvbuf]) if options[:rcvbuf]
|
8
|
+
sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, options[:sndbuf]) if options[:sndbuf]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
3
12
|
begin
|
4
13
|
require 'kgio'
|
5
14
|
puts "Using kgio socket IO" if defined?($TESTING) && $TESTING
|
@@ -44,11 +53,12 @@ begin
|
|
44
53
|
end
|
45
54
|
|
46
55
|
class Dalli::Server::KSocket::TCP < Dalli::Server::KSocket
|
56
|
+
extend Dalli::Server::TCPSocketOptions
|
57
|
+
|
47
58
|
def self.open(host, port, server, options = {})
|
48
59
|
addr = Socket.pack_sockaddr_in(port, host)
|
49
60
|
sock = start(addr)
|
50
|
-
sock
|
51
|
-
sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true) if options[:keepalive]
|
61
|
+
setsockopts(sock, options)
|
52
62
|
sock.options = options
|
53
63
|
sock.server = server
|
54
64
|
sock.kgio_wait_writable
|
@@ -114,13 +124,13 @@ rescue LoadError
|
|
114
124
|
end
|
115
125
|
|
116
126
|
class Dalli::Server::KSocket::TCP < TCPSocket
|
127
|
+
extend Dalli::Server::TCPSocketOptions
|
117
128
|
include Dalli::Server::KSocket
|
118
129
|
|
119
130
|
def self.open(host, port, server, options = {})
|
120
131
|
Timeout.timeout(options[:socket_timeout]) do
|
121
132
|
sock = new(host, port)
|
122
|
-
sock
|
123
|
-
sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true) if options[:keepalive]
|
133
|
+
setsockopts(sock, options)
|
124
134
|
sock.options = {:host => host, :port => port}.merge(options)
|
125
135
|
sock.server = server
|
126
136
|
sock
|
data/lib/dalli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dalli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Peter M. Goldstein
|
7
8
|
- Mike Perham
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2015-
|
12
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: minitest
|
@@ -52,8 +53,80 @@ dependencies:
|
|
52
53
|
- - "~>"
|
53
54
|
- !ruby/object:Gem::Version
|
54
55
|
version: '4'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: appraisal
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: connection_pool
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rdoc
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: simplecov
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
55
126
|
description: High performance memcached client for Ruby
|
56
|
-
email:
|
127
|
+
email:
|
128
|
+
- peter.m.goldstein@gmail.com
|
129
|
+
- mperham@gmail.com
|
57
130
|
executables: []
|
58
131
|
extensions: []
|
59
132
|
extra_rdoc_files: []
|
@@ -61,10 +134,7 @@ files:
|
|
61
134
|
- Gemfile
|
62
135
|
- History.md
|
63
136
|
- LICENSE
|
64
|
-
- Performance.md
|
65
137
|
- README.md
|
66
|
-
- Rakefile
|
67
|
-
- dalli.gemspec
|
68
138
|
- lib/action_dispatch/middleware/session/dalli_store.rb
|
69
139
|
- lib/active_support/cache/dalli_store.rb
|
70
140
|
- lib/dalli.rb
|
@@ -78,24 +148,7 @@ files:
|
|
78
148
|
- lib/dalli/socket.rb
|
79
149
|
- lib/dalli/version.rb
|
80
150
|
- lib/rack/session/dalli.rb
|
81
|
-
|
82
|
-
- test/helper.rb
|
83
|
-
- test/memcached_mock.rb
|
84
|
-
- test/sasl/memcached.conf
|
85
|
-
- test/sasl/sasldb
|
86
|
-
- test/test_active_support.rb
|
87
|
-
- test/test_cas_client.rb
|
88
|
-
- test/test_compressor.rb
|
89
|
-
- test/test_dalli.rb
|
90
|
-
- test/test_encoding.rb
|
91
|
-
- test/test_failover.rb
|
92
|
-
- test/test_network.rb
|
93
|
-
- test/test_rack_session.rb
|
94
|
-
- test/test_ring.rb
|
95
|
-
- test/test_sasl.rb
|
96
|
-
- test/test_serializer.rb
|
97
|
-
- test/test_server.rb
|
98
|
-
homepage: http://github.com/mperham/dalli
|
151
|
+
homepage: https://github.com/petergoldstein/dalli
|
99
152
|
licenses:
|
100
153
|
- MIT
|
101
154
|
metadata: {}
|
@@ -116,25 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
169
|
version: '0'
|
117
170
|
requirements: []
|
118
171
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.5.1
|
120
173
|
signing_key:
|
121
174
|
specification_version: 4
|
122
175
|
summary: High performance memcached client for Ruby
|
123
|
-
test_files:
|
124
|
-
- test/benchmark_test.rb
|
125
|
-
- test/helper.rb
|
126
|
-
- test/memcached_mock.rb
|
127
|
-
- test/sasl/memcached.conf
|
128
|
-
- test/sasl/sasldb
|
129
|
-
- test/test_active_support.rb
|
130
|
-
- test/test_cas_client.rb
|
131
|
-
- test/test_compressor.rb
|
132
|
-
- test/test_dalli.rb
|
133
|
-
- test/test_encoding.rb
|
134
|
-
- test/test_failover.rb
|
135
|
-
- test/test_network.rb
|
136
|
-
- test/test_rack_session.rb
|
137
|
-
- test/test_ring.rb
|
138
|
-
- test/test_sasl.rb
|
139
|
-
- test/test_serializer.rb
|
140
|
-
- test/test_server.rb
|
176
|
+
test_files: []
|
data/Performance.md
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
Performance
|
2
|
-
====================
|
3
|
-
|
4
|
-
Caching is all about performance, so I carefully track Dalli performance to ensure no regressions.
|
5
|
-
You can optionally use kgio to give Dalli a 10-20% performance boost: `gem install kgio`.
|
6
|
-
|
7
|
-
Note I've added some benchmarks over time to Dalli that the other libraries don't necessarily have.
|
8
|
-
|
9
|
-
memcache-client
|
10
|
-
---------------
|
11
|
-
|
12
|
-
Testing 1.8.5 with ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
|
13
|
-
|
14
|
-
user system total real
|
15
|
-
set:plain:memcache-client 1.860000 0.310000 2.170000 ( 2.188030)
|
16
|
-
set:ruby:memcache-client 1.830000 0.290000 2.120000 ( 2.130212)
|
17
|
-
get:plain:memcache-client 1.830000 0.340000 2.170000 ( 2.176156)
|
18
|
-
get:ruby:memcache-client 1.900000 0.330000 2.230000 ( 2.235045)
|
19
|
-
multiget:ruby:memcache-client 0.860000 0.120000 0.980000 ( 0.987348)
|
20
|
-
missing:ruby:memcache-client 1.630000 0.320000 1.950000 ( 1.954867)
|
21
|
-
mixed:ruby:memcache-client 3.690000 0.670000 4.360000 ( 4.364469)
|
22
|
-
|
23
|
-
|
24
|
-
dalli
|
25
|
-
-----
|
26
|
-
|
27
|
-
Testing with Rails 3.2.1
|
28
|
-
Using kgio socket IO
|
29
|
-
Testing 2.0.0 with ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
|
30
|
-
|
31
|
-
user system total real
|
32
|
-
mixed:rails:dalli 1.580000 0.570000 2.150000 ( 3.008839)
|
33
|
-
set:plain:dalli 0.730000 0.300000 1.030000 ( 1.567098)
|
34
|
-
setq:plain:dalli 0.520000 0.120000 0.640000 ( 0.634402)
|
35
|
-
set:ruby:dalli 0.800000 0.300000 1.100000 ( 1.640348)
|
36
|
-
get:plain:dalli 0.840000 0.330000 1.170000 ( 1.668425)
|
37
|
-
get:ruby:dalli 0.850000 0.330000 1.180000 ( 1.665716)
|
38
|
-
multiget:ruby:dalli 0.700000 0.260000 0.960000 ( 0.965423)
|
39
|
-
missing:ruby:dalli 0.720000 0.320000 1.040000 ( 1.511720)
|
40
|
-
mixed:ruby:dalli 1.660000 0.640000 2.300000 ( 3.320743)
|
41
|
-
mixedq:ruby:dalli 1.630000 0.510000 2.140000 ( 2.629734)
|
42
|
-
incr:ruby:dalli 0.270000 0.100000 0.370000 ( 0.547618)
|
data/Rakefile
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'appraisal'
|
3
|
-
require 'rake/testtask'
|
4
|
-
Rake::TestTask.new(:test) do |test|
|
5
|
-
test.libs << 'test'
|
6
|
-
test.pattern = 'test/**/test_*.rb'
|
7
|
-
test.warning = true
|
8
|
-
test.verbose = true
|
9
|
-
end
|
10
|
-
|
11
|
-
Rake::TestTask.new(:bench) do |test|
|
12
|
-
test.libs << 'test'
|
13
|
-
test.pattern = 'test/benchmark_test.rb'
|
14
|
-
end
|
15
|
-
|
16
|
-
begin
|
17
|
-
require 'metric_fu'
|
18
|
-
MetricFu::Configuration.run do |config|
|
19
|
-
config.rcov[:rcov_opts] << "-Itest:lib"
|
20
|
-
end
|
21
|
-
rescue LoadError
|
22
|
-
end
|
23
|
-
|
24
|
-
task :default => :test
|
25
|
-
|
26
|
-
task :test_all do
|
27
|
-
system('rake test RAILS_VERSION="~> 3.0.0"')
|
28
|
-
system('rake test RAILS_VERSION=">= 3.0.0"')
|
29
|
-
end
|
30
|
-
|
31
|
-
# 'gem install rdoc' to upgrade RDoc if this is giving you errors
|
32
|
-
begin
|
33
|
-
require 'rdoc/task'
|
34
|
-
RDoc::Task.new do |rd|
|
35
|
-
rd.rdoc_files.include("lib/**/*.rb")
|
36
|
-
end
|
37
|
-
rescue LoadError
|
38
|
-
puts "Unable to load rdoc, run 'gem install rdoc' to fix this."
|
39
|
-
end
|
40
|
-
|
41
|
-
require 'rake/clean'
|
42
|
-
CLEAN.include "**/*.rbc"
|
43
|
-
CLEAN.include "**/.DS_Store"
|
data/dalli.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require './lib/dalli/version'
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{dalli}
|
5
|
-
s.version = Dalli::VERSION
|
6
|
-
s.license = "MIT"
|
7
|
-
|
8
|
-
s.authors = ["Mike Perham"]
|
9
|
-
s.description = %q{High performance memcached client for Ruby}
|
10
|
-
s.email = %q{mperham@gmail.com}
|
11
|
-
s.files = Dir.glob("lib/**/*") + [
|
12
|
-
"LICENSE",
|
13
|
-
"README.md",
|
14
|
-
"History.md",
|
15
|
-
"Rakefile",
|
16
|
-
"Gemfile",
|
17
|
-
"dalli.gemspec",
|
18
|
-
"Performance.md",
|
19
|
-
]
|
20
|
-
s.homepage = %q{http://github.com/mperham/dalli}
|
21
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
22
|
-
s.require_paths = ["lib"]
|
23
|
-
s.summary = %q{High performance memcached client for Ruby}
|
24
|
-
s.test_files = Dir.glob("test/**/*")
|
25
|
-
s.add_development_dependency(%q<minitest>, [">= 4.2.0"])
|
26
|
-
s.add_development_dependency(%q<mocha>, [">= 0"])
|
27
|
-
s.add_development_dependency(%q<rails>, ["~> 4"])
|
28
|
-
end
|
29
|
-
|
data/test/benchmark_test.rb
DELETED
@@ -1,243 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'benchmark'
|
3
|
-
require 'active_support/cache/dalli_store'
|
4
|
-
|
5
|
-
describe 'performance' do
|
6
|
-
before do
|
7
|
-
puts "Testing #{Dalli::VERSION} with #{RUBY_DESCRIPTION}"
|
8
|
-
# We'll use a simple @value to try to avoid spending time in Marshal,
|
9
|
-
# which is a constant penalty that both clients have to pay
|
10
|
-
@value = []
|
11
|
-
@marshalled = Marshal.dump(@value)
|
12
|
-
|
13
|
-
@port = 23417
|
14
|
-
@servers = ["127.0.0.1:#{@port}", "localhost:#{@port}"]
|
15
|
-
@key1 = "Short"
|
16
|
-
@key2 = "Sym1-2-3::45"*8
|
17
|
-
@key3 = "Long"*40
|
18
|
-
@key4 = "Medium"*8
|
19
|
-
# 5 and 6 are only used for multiget miss test
|
20
|
-
@key5 = "Medium2"*8
|
21
|
-
@key6 = "Long3"*40
|
22
|
-
@counter = 'counter'
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'runs benchmarks' do
|
26
|
-
memcached(@port) do
|
27
|
-
|
28
|
-
Benchmark.bm(37) do |x|
|
29
|
-
|
30
|
-
n = 2500
|
31
|
-
|
32
|
-
@ds = ActiveSupport::Cache::DalliStore.new(@servers)
|
33
|
-
x.report("mixed:rails:dalli") do
|
34
|
-
n.times do
|
35
|
-
@ds.read @key1
|
36
|
-
@ds.write @key2, @value
|
37
|
-
@ds.fetch(@key3) { @value }
|
38
|
-
@ds.fetch(@key2) { @value }
|
39
|
-
@ds.fetch(@key1) { @value }
|
40
|
-
@ds.write @key2, @value, :unless_exists => true
|
41
|
-
@ds.delete @key2
|
42
|
-
@ds.increment @counter, 1, :initial => 100
|
43
|
-
@ds.increment @counter, 1, :expires_in => 12
|
44
|
-
@ds.decrement @counter, 1
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
x.report("mixed:rails-localcache:dalli") do
|
49
|
-
n.times do
|
50
|
-
@ds.with_local_cache do
|
51
|
-
@ds.read @key1
|
52
|
-
@ds.write @key2, @value
|
53
|
-
@ds.fetch(@key3) { @value }
|
54
|
-
@ds.fetch(@key2) { @value }
|
55
|
-
@ds.fetch(@key1) { @value }
|
56
|
-
@ds.write @key2, @value, :unless_exists => true
|
57
|
-
@ds.delete @key2
|
58
|
-
@ds.increment @counter, 1, :initial => 100
|
59
|
-
@ds.increment @counter, 1, :expires_in => 12
|
60
|
-
@ds.decrement @counter, 1
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
@ds.clear
|
66
|
-
sizeable_data = "<marquee>some view partial data</marquee>" * 50
|
67
|
-
[@key1, @key2, @key3, @key4, @key5, @key6].each do |key|
|
68
|
-
@ds.write(key, sizeable_data)
|
69
|
-
end
|
70
|
-
|
71
|
-
x.report("read_multi_big:rails:dalli") do
|
72
|
-
n.times do
|
73
|
-
@ds.read_multi @key1, @key2, @key3, @key4
|
74
|
-
@ds.read @key1
|
75
|
-
@ds.read @key2
|
76
|
-
@ds.read @key3
|
77
|
-
@ds.read @key4
|
78
|
-
@ds.read @key1
|
79
|
-
@ds.read @key2
|
80
|
-
@ds.read @key3
|
81
|
-
@ds.read_multi @key1, @key2, @key3
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
x.report("read_multi_big:rails-localcache:dalli") do
|
86
|
-
n.times do
|
87
|
-
@ds.with_local_cache do
|
88
|
-
@ds.read_multi @key1, @key2, @key3, @key4
|
89
|
-
@ds.read @key1
|
90
|
-
@ds.read @key2
|
91
|
-
@ds.read @key3
|
92
|
-
@ds.read @key4
|
93
|
-
end
|
94
|
-
@ds.with_local_cache do
|
95
|
-
@ds.read @key1
|
96
|
-
@ds.read @key2
|
97
|
-
@ds.read @key3
|
98
|
-
@ds.read_multi @key1, @key2, @key3
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
@m = Dalli::Client.new(@servers)
|
104
|
-
x.report("set:plain:dalli") do
|
105
|
-
n.times do
|
106
|
-
@m.set @key1, @marshalled, 0, :raw => true
|
107
|
-
@m.set @key2, @marshalled, 0, :raw => true
|
108
|
-
@m.set @key3, @marshalled, 0, :raw => true
|
109
|
-
@m.set @key1, @marshalled, 0, :raw => true
|
110
|
-
@m.set @key2, @marshalled, 0, :raw => true
|
111
|
-
@m.set @key3, @marshalled, 0, :raw => true
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
@m = Dalli::Client.new(@servers)
|
116
|
-
x.report("setq:plain:dalli") do
|
117
|
-
@m.multi do
|
118
|
-
n.times do
|
119
|
-
@m.set @key1, @marshalled, 0, :raw => true
|
120
|
-
@m.set @key2, @marshalled, 0, :raw => true
|
121
|
-
@m.set @key3, @marshalled, 0, :raw => true
|
122
|
-
@m.set @key1, @marshalled, 0, :raw => true
|
123
|
-
@m.set @key2, @marshalled, 0, :raw => true
|
124
|
-
@m.set @key3, @marshalled, 0, :raw => true
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
@m = Dalli::Client.new(@servers)
|
130
|
-
x.report("set:ruby:dalli") do
|
131
|
-
n.times do
|
132
|
-
@m.set @key1, @value
|
133
|
-
@m.set @key2, @value
|
134
|
-
@m.set @key3, @value
|
135
|
-
@m.set @key1, @value
|
136
|
-
@m.set @key2, @value
|
137
|
-
@m.set @key3, @value
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
@m = Dalli::Client.new(@servers)
|
142
|
-
x.report("get:plain:dalli") do
|
143
|
-
n.times do
|
144
|
-
@m.get @key1, :raw => true
|
145
|
-
@m.get @key2, :raw => true
|
146
|
-
@m.get @key3, :raw => true
|
147
|
-
@m.get @key1, :raw => true
|
148
|
-
@m.get @key2, :raw => true
|
149
|
-
@m.get @key3, :raw => true
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
@m = Dalli::Client.new(@servers)
|
154
|
-
x.report("get:ruby:dalli") do
|
155
|
-
n.times do
|
156
|
-
@m.get @key1
|
157
|
-
@m.get @key2
|
158
|
-
@m.get @key3
|
159
|
-
@m.get @key1
|
160
|
-
@m.get @key2
|
161
|
-
@m.get @key3
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
@m = Dalli::Client.new(@servers)
|
166
|
-
x.report("multiget:ruby:dalli") do
|
167
|
-
n.times do
|
168
|
-
# We don't use the keys array because splat is slow
|
169
|
-
@m.get_multi @key1, @key2, @key3, @key4, @key5, @key6
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
@m = Dalli::Client.new(@servers)
|
174
|
-
x.report("missing:ruby:dalli") do
|
175
|
-
n.times do
|
176
|
-
begin @m.delete @key1; rescue; end
|
177
|
-
begin @m.get @key1; rescue; end
|
178
|
-
begin @m.delete @key2; rescue; end
|
179
|
-
begin @m.get @key2; rescue; end
|
180
|
-
begin @m.delete @key3; rescue; end
|
181
|
-
begin @m.get @key3; rescue; end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
@m = Dalli::Client.new(@servers)
|
186
|
-
x.report("mixed:ruby:dalli") do
|
187
|
-
n.times do
|
188
|
-
@m.set @key1, @value
|
189
|
-
@m.set @key2, @value
|
190
|
-
@m.set @key3, @value
|
191
|
-
@m.get @key1
|
192
|
-
@m.get @key2
|
193
|
-
@m.get @key3
|
194
|
-
@m.set @key1, @value
|
195
|
-
@m.get @key1
|
196
|
-
@m.set @key2, @value
|
197
|
-
@m.get @key2
|
198
|
-
@m.set @key3, @value
|
199
|
-
@m.get @key3
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
@m = Dalli::Client.new(@servers)
|
204
|
-
x.report("mixedq:ruby:dalli") do
|
205
|
-
@m.multi do
|
206
|
-
n.times do
|
207
|
-
@m.set @key1, @value
|
208
|
-
@m.set @key2, @value
|
209
|
-
@m.set @key3, @value
|
210
|
-
@m.get @key1
|
211
|
-
@m.get @key2
|
212
|
-
@m.get @key3
|
213
|
-
@m.set @key1, @value
|
214
|
-
@m.get @key1
|
215
|
-
@m.set @key2, @value
|
216
|
-
@m.replace @key2, @value
|
217
|
-
@m.delete @key3
|
218
|
-
@m.add @key3, @value
|
219
|
-
@m.get @key2
|
220
|
-
@m.set @key3, @value
|
221
|
-
@m.get @key3
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
@m = Dalli::Client.new(@servers)
|
227
|
-
x.report("incr:ruby:dalli") do
|
228
|
-
counter = 'foocount'
|
229
|
-
n.times do
|
230
|
-
@m.incr counter, 1, 0, 1
|
231
|
-
end
|
232
|
-
n.times do
|
233
|
-
@m.decr counter, 1
|
234
|
-
end
|
235
|
-
|
236
|
-
assert_equal 0, @m.incr(counter, 0)
|
237
|
-
end
|
238
|
-
|
239
|
-
end
|
240
|
-
end
|
241
|
-
|
242
|
-
end
|
243
|
-
end
|