redis-client 0.18.0 → 0.24.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +58 -0
- data/README.md +31 -7
- data/lib/redis_client/circuit_breaker.rb +2 -2
- data/lib/redis_client/config.rb +66 -31
- data/lib/redis_client/connection_mixin.rb +27 -8
- data/lib/redis_client/decorator.rb +2 -2
- data/lib/redis_client/ruby_connection/buffered_io.rb +124 -35
- data/lib/redis_client/ruby_connection/resp3.rb +35 -12
- data/lib/redis_client/ruby_connection.rb +19 -11
- data/lib/redis_client/sentinel_config.rb +16 -1
- data/lib/redis_client/url_config.rb +29 -8
- data/lib/redis_client/version.rb +1 -1
- data/lib/redis_client.rb +54 -12
- metadata +4 -12
- data/Gemfile +0 -22
- data/Gemfile.lock +0 -66
- data/Rakefile +0 -123
- data/redis-client.gemspec +0 -32
data/Rakefile
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "rake/extensiontask"
|
|
4
|
-
require "rake/testtask"
|
|
5
|
-
require 'rubocop/rake_task'
|
|
6
|
-
|
|
7
|
-
RuboCop::RakeTask.new
|
|
8
|
-
|
|
9
|
-
require "rake/clean"
|
|
10
|
-
CLOBBER.include "pkg"
|
|
11
|
-
require "bundler/gem_helper"
|
|
12
|
-
Bundler::GemHelper.install_tasks(name: "redis-client")
|
|
13
|
-
Bundler::GemHelper.install_tasks(dir: "hiredis-client", name: "hiredis-client")
|
|
14
|
-
|
|
15
|
-
gemspec = Gem::Specification.load("redis-client.gemspec")
|
|
16
|
-
Rake::ExtensionTask.new do |ext|
|
|
17
|
-
ext.name = "hiredis_connection"
|
|
18
|
-
ext.ext_dir = "hiredis-client/ext/redis_client/hiredis"
|
|
19
|
-
ext.lib_dir = "hiredis-client/lib/redis_client"
|
|
20
|
-
ext.gem_spec = gemspec
|
|
21
|
-
CLEAN.add("#{ext.ext_dir}/vendor/*.{a,o}")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
namespace :test do
|
|
25
|
-
Rake::TestTask.new(:ruby) do |t|
|
|
26
|
-
t.libs << "test"
|
|
27
|
-
t.libs << "lib"
|
|
28
|
-
t.test_files = FileList["test/**/*_test.rb"].exclude("test/sentinel/*_test.rb")
|
|
29
|
-
t.options = '-v' if ENV['CI'] || ENV['VERBOSE']
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
Rake::TestTask.new(:sentinel) do |t|
|
|
33
|
-
t.libs << "test/sentinel"
|
|
34
|
-
t.libs << "test"
|
|
35
|
-
t.libs << "lib"
|
|
36
|
-
t.test_files = FileList["test/sentinel/*_test.rb"]
|
|
37
|
-
t.options = '-v' if ENV['CI'] || ENV['VERBOSE']
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
Rake::TestTask.new(:hiredis) do |t|
|
|
41
|
-
t.libs << "test/hiredis"
|
|
42
|
-
t.libs << "test"
|
|
43
|
-
t.libs << "hiredis-client/lib"
|
|
44
|
-
t.libs << "lib"
|
|
45
|
-
t.test_files = FileList["test/**/*_test.rb"].exclude("test/sentinel/*_test.rb")
|
|
46
|
-
t.options = '-v' if ENV['CI'] || ENV['VERBOSE']
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
hiredis_supported = RUBY_ENGINE == "ruby" && !RUBY_PLATFORM.match?(/mswin/)
|
|
51
|
-
if hiredis_supported
|
|
52
|
-
task test: %i[test:ruby test:hiredis test:sentinel]
|
|
53
|
-
else
|
|
54
|
-
task test: %i[test:ruby test:sentinel]
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
namespace :hiredis do
|
|
58
|
-
task :download do
|
|
59
|
-
version = "1.0.2"
|
|
60
|
-
archive_path = "tmp/hiredis-#{version}.tar.gz"
|
|
61
|
-
url = "https://github.com/redis/hiredis/archive/refs/tags/v#{version}.tar.gz"
|
|
62
|
-
system("curl", "-L", url, out: archive_path) or raise "Downloading of #{url} failed"
|
|
63
|
-
system("rm", "-rf", "hiredis-client/ext/redis_client/hiredis/vendor/")
|
|
64
|
-
system("mkdir", "-p", "hiredis-client/ext/redis_client/hiredis/vendor/")
|
|
65
|
-
system(
|
|
66
|
-
"tar", "xvzf", archive_path,
|
|
67
|
-
"-C", "hiredis-client/ext/redis_client/hiredis/vendor",
|
|
68
|
-
"--strip-components", "1",
|
|
69
|
-
)
|
|
70
|
-
system("rm", "-rf", "hiredis-client/ext/redis_client/hiredis/vendor/examples")
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
benchmark_suites = %w(single pipelined)
|
|
75
|
-
benchmark_modes = %i[ruby yjit hiredis]
|
|
76
|
-
namespace :benchmark do
|
|
77
|
-
benchmark_suites.each do |suite|
|
|
78
|
-
benchmark_modes.each do |mode|
|
|
79
|
-
name = "#{suite}_#{mode}"
|
|
80
|
-
task name do
|
|
81
|
-
output_path = "benchmark/#{name}.md"
|
|
82
|
-
sh "rm", "-f", output_path
|
|
83
|
-
File.open(output_path, "w+") do |output|
|
|
84
|
-
output.puts("ruby: `#{RUBY_DESCRIPTION}`\n\n")
|
|
85
|
-
output.puts("redis-server: `#{`redis-server -v`.strip}`\n\n")
|
|
86
|
-
output.puts
|
|
87
|
-
output.flush
|
|
88
|
-
env = {}
|
|
89
|
-
args = []
|
|
90
|
-
args << "--yjit" if mode == :yjit
|
|
91
|
-
env["DRIVER"] = mode == :hiredis ? "hiredis" : "ruby"
|
|
92
|
-
system(env, RbConfig.ruby, *args, "benchmark/#{suite}.rb", out: output)
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
skipping = false
|
|
96
|
-
output = File.readlines(output_path).reject do |line|
|
|
97
|
-
if skipping
|
|
98
|
-
if line == "Comparison:\n"
|
|
99
|
-
skipping = false
|
|
100
|
-
true
|
|
101
|
-
else
|
|
102
|
-
skipping
|
|
103
|
-
end
|
|
104
|
-
else
|
|
105
|
-
skipping = true if line.start_with?("Warming up ---")
|
|
106
|
-
skipping
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
File.write(output_path, output.join)
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
task all: benchmark_suites.flat_map { |s| benchmark_modes.flat_map { |m| "#{s}_#{m}" } }
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
if hiredis_supported
|
|
118
|
-
task default: %i[compile test rubocop]
|
|
119
|
-
task ci: %i[compile test:ruby test:hiredis]
|
|
120
|
-
else
|
|
121
|
-
task default: %i[test rubocop]
|
|
122
|
-
task ci: %i[test:ruby]
|
|
123
|
-
end
|
data/redis-client.gemspec
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "lib/redis_client/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = "redis-client"
|
|
7
|
-
spec.version = RedisClient::VERSION
|
|
8
|
-
spec.authors = ["Jean Boussier"]
|
|
9
|
-
spec.email = ["jean.boussier@gmail.com"]
|
|
10
|
-
|
|
11
|
-
spec.summary = "Simple low-level client for Redis 6+"
|
|
12
|
-
spec.homepage = "https://github.com/redis-rb/redis-client"
|
|
13
|
-
spec.license = "MIT"
|
|
14
|
-
spec.required_ruby_version = ">= 2.5.0"
|
|
15
|
-
|
|
16
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
17
|
-
|
|
18
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
|
19
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
|
20
|
-
spec.metadata["changelog_uri"] = File.join(spec.homepage, "blob/master/CHANGELOG.md")
|
|
21
|
-
|
|
22
|
-
# Specify which files should be added to the gem when it is released.
|
|
23
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
24
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
25
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
|
26
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|hiredis-client|test|spec|features|benchmark)/|\.(?:git|rubocop))})
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
spec.require_paths = ["lib"]
|
|
30
|
-
|
|
31
|
-
spec.add_runtime_dependency "connection_pool"
|
|
32
|
-
end
|