discourse-redis 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.travis.yml +59 -0
- data/.travis/Gemfile +11 -0
- data/.yardopts +3 -0
- data/CHANGELOG.md +349 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +328 -0
- data/Rakefile +87 -0
- data/benchmarking/logging.rb +71 -0
- data/benchmarking/pipeline.rb +51 -0
- data/benchmarking/speed.rb +21 -0
- data/benchmarking/suite.rb +24 -0
- data/benchmarking/worker.rb +71 -0
- data/examples/basic.rb +15 -0
- data/examples/consistency.rb +114 -0
- data/examples/dist_redis.rb +43 -0
- data/examples/incr-decr.rb +17 -0
- data/examples/list.rb +26 -0
- data/examples/pubsub.rb +37 -0
- data/examples/sentinel.rb +41 -0
- data/examples/sentinel/start +49 -0
- data/examples/sets.rb +36 -0
- data/examples/unicorn/config.ru +3 -0
- data/examples/unicorn/unicorn.rb +20 -0
- data/lib/redis.rb +2731 -0
- data/lib/redis/client.rb +575 -0
- data/lib/redis/connection.rb +9 -0
- data/lib/redis/connection/command_helper.rb +44 -0
- data/lib/redis/connection/hiredis.rb +64 -0
- data/lib/redis/connection/registry.rb +12 -0
- data/lib/redis/connection/ruby.rb +322 -0
- data/lib/redis/connection/synchrony.rb +124 -0
- data/lib/redis/distributed.rb +873 -0
- data/lib/redis/errors.rb +40 -0
- data/lib/redis/hash_ring.rb +132 -0
- data/lib/redis/pipeline.rb +141 -0
- data/lib/redis/subscribe.rb +83 -0
- data/lib/redis/version.rb +3 -0
- data/redis.gemspec +34 -0
- data/test/bitpos_test.rb +69 -0
- data/test/blocking_commands_test.rb +42 -0
- data/test/command_map_test.rb +30 -0
- data/test/commands_on_hashes_test.rb +21 -0
- data/test/commands_on_hyper_log_log_test.rb +21 -0
- data/test/commands_on_lists_test.rb +20 -0
- data/test/commands_on_sets_test.rb +77 -0
- data/test/commands_on_sorted_sets_test.rb +137 -0
- data/test/commands_on_strings_test.rb +101 -0
- data/test/commands_on_value_types_test.rb +133 -0
- data/test/connection_handling_test.rb +250 -0
- data/test/distributed_blocking_commands_test.rb +46 -0
- data/test/distributed_commands_on_hashes_test.rb +10 -0
- data/test/distributed_commands_on_hyper_log_log_test.rb +33 -0
- data/test/distributed_commands_on_lists_test.rb +22 -0
- data/test/distributed_commands_on_sets_test.rb +83 -0
- data/test/distributed_commands_on_sorted_sets_test.rb +18 -0
- data/test/distributed_commands_on_strings_test.rb +59 -0
- data/test/distributed_commands_on_value_types_test.rb +95 -0
- data/test/distributed_commands_requiring_clustering_test.rb +164 -0
- data/test/distributed_connection_handling_test.rb +23 -0
- data/test/distributed_internals_test.rb +79 -0
- data/test/distributed_key_tags_test.rb +52 -0
- data/test/distributed_persistence_control_commands_test.rb +26 -0
- data/test/distributed_publish_subscribe_test.rb +92 -0
- data/test/distributed_remote_server_control_commands_test.rb +66 -0
- data/test/distributed_scripting_test.rb +102 -0
- data/test/distributed_sorting_test.rb +20 -0
- data/test/distributed_test.rb +58 -0
- data/test/distributed_transactions_test.rb +32 -0
- data/test/encoding_test.rb +18 -0
- data/test/error_replies_test.rb +59 -0
- data/test/fork_safety_test.rb +65 -0
- data/test/helper.rb +232 -0
- data/test/helper_test.rb +24 -0
- data/test/internals_test.rb +437 -0
- data/test/lint/blocking_commands.rb +150 -0
- data/test/lint/hashes.rb +162 -0
- data/test/lint/hyper_log_log.rb +60 -0
- data/test/lint/lists.rb +143 -0
- data/test/lint/sets.rb +125 -0
- data/test/lint/sorted_sets.rb +316 -0
- data/test/lint/strings.rb +260 -0
- data/test/lint/value_types.rb +122 -0
- data/test/persistence_control_commands_test.rb +26 -0
- data/test/pipelining_commands_test.rb +242 -0
- data/test/publish_subscribe_test.rb +254 -0
- data/test/remote_server_control_commands_test.rb +118 -0
- data/test/scanning_test.rb +413 -0
- data/test/scripting_test.rb +78 -0
- data/test/sentinel_command_test.rb +80 -0
- data/test/sentinel_test.rb +255 -0
- data/test/sorting_test.rb +59 -0
- data/test/support/connection/hiredis.rb +1 -0
- data/test/support/connection/ruby.rb +1 -0
- data/test/support/connection/synchrony.rb +17 -0
- data/test/support/redis_mock.rb +119 -0
- data/test/support/wire/synchrony.rb +24 -0
- data/test/support/wire/thread.rb +5 -0
- data/test/synchrony_driver.rb +88 -0
- data/test/test.conf.erb +9 -0
- data/test/thread_safety_test.rb +32 -0
- data/test/transactions_test.rb +264 -0
- data/test/unknown_commands_test.rb +14 -0
- data/test/url_param_test.rb +138 -0
- metadata +182 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require File.expand_path("helper", File.dirname(__FILE__))
|
4
|
+
|
5
|
+
class TestUnknownCommands < Test::Unit::TestCase
|
6
|
+
|
7
|
+
include Helper::Client
|
8
|
+
|
9
|
+
def test_should_try_to_work
|
10
|
+
assert_raise Redis::CommandError do
|
11
|
+
r.not_yet_implemented_command
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require File.expand_path("helper", File.dirname(__FILE__))
|
4
|
+
|
5
|
+
class TestUrlParam < Test::Unit::TestCase
|
6
|
+
|
7
|
+
include Helper::Client
|
8
|
+
|
9
|
+
def test_url_defaults_to_______________
|
10
|
+
redis = Redis.new
|
11
|
+
|
12
|
+
assert_equal "127.0.0.1", redis.client.host
|
13
|
+
assert_equal 6379, redis.client.port
|
14
|
+
assert_equal 0, redis.client.db
|
15
|
+
assert_equal nil, redis.client.password
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_allows_to_pass_in_a_url
|
19
|
+
redis = Redis.new :url => "redis://:secr3t@foo.com:999/2"
|
20
|
+
|
21
|
+
assert_equal "foo.com", redis.client.host
|
22
|
+
assert_equal 999, redis.client.port
|
23
|
+
assert_equal 2, redis.client.db
|
24
|
+
assert_equal "secr3t", redis.client.password
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_allows_to_pass_in_a_url_with_string_key
|
28
|
+
redis = Redis.new "url" => "redis://:secr3t@foo.com:999/2"
|
29
|
+
|
30
|
+
assert_equal "foo.com", redis.client.host
|
31
|
+
assert_equal 999, redis.client.port
|
32
|
+
assert_equal 2, redis.client.db
|
33
|
+
assert_equal "secr3t", redis.client.password
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_unescape_password_from_url
|
37
|
+
redis = Redis.new :url => "redis://:secr3t%3A@foo.com:999/2"
|
38
|
+
|
39
|
+
assert_equal "secr3t:", redis.client.password
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_unescape_password_from_url_with_string_key
|
43
|
+
redis = Redis.new "url" => "redis://:secr3t%3A@foo.com:999/2"
|
44
|
+
|
45
|
+
assert_equal "secr3t:", redis.client.password
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_does_not_unescape_password_when_explicitly_passed
|
49
|
+
redis = Redis.new :url => "redis://:secr3t%3A@foo.com:999/2", :password => "secr3t%3A"
|
50
|
+
|
51
|
+
assert_equal "secr3t%3A", redis.client.password
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_does_not_unescape_password_when_explicitly_passed_with_string_key
|
55
|
+
redis = Redis.new :url => "redis://:secr3t%3A@foo.com:999/2", "password" => "secr3t%3A"
|
56
|
+
|
57
|
+
assert_equal "secr3t%3A", redis.client.password
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_override_url_if_path_option_is_passed
|
61
|
+
redis = Redis.new :url => "redis://:secr3t@foo.com/foo:999/2", :path => "/tmp/redis.sock"
|
62
|
+
|
63
|
+
assert_equal "/tmp/redis.sock", redis.client.path
|
64
|
+
assert_equal nil, redis.client.host
|
65
|
+
assert_equal nil, redis.client.port
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_override_url_if_path_option_is_passed_with_string_key
|
69
|
+
redis = Redis.new :url => "redis://:secr3t@foo.com/foo:999/2", "path" => "/tmp/redis.sock"
|
70
|
+
|
71
|
+
assert_equal "/tmp/redis.sock", redis.client.path
|
72
|
+
assert_equal nil, redis.client.host
|
73
|
+
assert_equal nil, redis.client.port
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_overrides_url_if_another_connection_option_is_passed
|
77
|
+
redis = Redis.new :url => "redis://:secr3t@foo.com:999/2", :port => 1000
|
78
|
+
|
79
|
+
assert_equal "foo.com", redis.client.host
|
80
|
+
assert_equal 1000, redis.client.port
|
81
|
+
assert_equal 2, redis.client.db
|
82
|
+
assert_equal "secr3t", redis.client.password
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_overrides_url_if_another_connection_option_is_passed_with_string_key
|
86
|
+
redis = Redis.new :url => "redis://:secr3t@foo.com:999/2", "port" => 1000
|
87
|
+
|
88
|
+
assert_equal "foo.com", redis.client.host
|
89
|
+
assert_equal 1000, redis.client.port
|
90
|
+
assert_equal 2, redis.client.db
|
91
|
+
assert_equal "secr3t", redis.client.password
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_does_not_overrides_url_if_a_nil_option_is_passed
|
95
|
+
redis = Redis.new :url => "redis://:secr3t@foo.com:999/2", :port => nil
|
96
|
+
|
97
|
+
assert_equal "foo.com", redis.client.host
|
98
|
+
assert_equal 999, redis.client.port
|
99
|
+
assert_equal 2, redis.client.db
|
100
|
+
assert_equal "secr3t", redis.client.password
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_does_not_overrides_url_if_a_nil_option_is_passed_with_string_key
|
104
|
+
redis = Redis.new :url => "redis://:secr3t@foo.com:999/2", "port" => nil
|
105
|
+
|
106
|
+
assert_equal "foo.com", redis.client.host
|
107
|
+
assert_equal 999, redis.client.port
|
108
|
+
assert_equal 2, redis.client.db
|
109
|
+
assert_equal "secr3t", redis.client.password
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_does_not_modify_the_passed_options
|
113
|
+
options = { :url => "redis://:secr3t@foo.com:999/2" }
|
114
|
+
|
115
|
+
Redis.new(options)
|
116
|
+
|
117
|
+
assert({ :url => "redis://:secr3t@foo.com:999/2" } == options)
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_uses_redis_url_over_default_if_available
|
121
|
+
ENV["REDIS_URL"] = "redis://:secr3t@foo.com:999/2"
|
122
|
+
|
123
|
+
redis = Redis.new
|
124
|
+
|
125
|
+
assert_equal "foo.com", redis.client.host
|
126
|
+
assert_equal 999, redis.client.port
|
127
|
+
assert_equal 2, redis.client.db
|
128
|
+
assert_equal "secr3t", redis.client.password
|
129
|
+
|
130
|
+
ENV.delete("REDIS_URL")
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_defaults_to_localhost
|
134
|
+
redis = Redis.new(:url => "redis:///")
|
135
|
+
|
136
|
+
assert_equal "127.0.0.1", redis.client.host
|
137
|
+
end
|
138
|
+
end
|
metadata
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: discourse-redis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.2.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alan Tan Guo Xiang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: test-unit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: |2
|
42
|
+
A Ruby client that tries to match Redis' API one-to-one, while still
|
43
|
+
providing an idiomatic interface. It features thread-safety,
|
44
|
+
client-side sharding, pipelining, and an obsession for performance.
|
45
|
+
email:
|
46
|
+
- tgx_world@hotmail.com
|
47
|
+
executables: []
|
48
|
+
extensions: []
|
49
|
+
extra_rdoc_files: []
|
50
|
+
files:
|
51
|
+
- ".gitignore"
|
52
|
+
- ".travis.yml"
|
53
|
+
- ".travis/Gemfile"
|
54
|
+
- ".yardopts"
|
55
|
+
- CHANGELOG.md
|
56
|
+
- Gemfile
|
57
|
+
- LICENSE
|
58
|
+
- README.md
|
59
|
+
- Rakefile
|
60
|
+
- benchmarking/logging.rb
|
61
|
+
- benchmarking/pipeline.rb
|
62
|
+
- benchmarking/speed.rb
|
63
|
+
- benchmarking/suite.rb
|
64
|
+
- benchmarking/worker.rb
|
65
|
+
- examples/basic.rb
|
66
|
+
- examples/consistency.rb
|
67
|
+
- examples/dist_redis.rb
|
68
|
+
- examples/incr-decr.rb
|
69
|
+
- examples/list.rb
|
70
|
+
- examples/pubsub.rb
|
71
|
+
- examples/sentinel.rb
|
72
|
+
- examples/sentinel/sentinel.conf
|
73
|
+
- examples/sentinel/start
|
74
|
+
- examples/sets.rb
|
75
|
+
- examples/unicorn/config.ru
|
76
|
+
- examples/unicorn/unicorn.rb
|
77
|
+
- lib/redis.rb
|
78
|
+
- lib/redis/client.rb
|
79
|
+
- lib/redis/connection.rb
|
80
|
+
- lib/redis/connection/command_helper.rb
|
81
|
+
- lib/redis/connection/hiredis.rb
|
82
|
+
- lib/redis/connection/registry.rb
|
83
|
+
- lib/redis/connection/ruby.rb
|
84
|
+
- lib/redis/connection/synchrony.rb
|
85
|
+
- lib/redis/distributed.rb
|
86
|
+
- lib/redis/errors.rb
|
87
|
+
- lib/redis/hash_ring.rb
|
88
|
+
- lib/redis/pipeline.rb
|
89
|
+
- lib/redis/subscribe.rb
|
90
|
+
- lib/redis/version.rb
|
91
|
+
- redis.gemspec
|
92
|
+
- test/bitpos_test.rb
|
93
|
+
- test/blocking_commands_test.rb
|
94
|
+
- test/command_map_test.rb
|
95
|
+
- test/commands_on_hashes_test.rb
|
96
|
+
- test/commands_on_hyper_log_log_test.rb
|
97
|
+
- test/commands_on_lists_test.rb
|
98
|
+
- test/commands_on_sets_test.rb
|
99
|
+
- test/commands_on_sorted_sets_test.rb
|
100
|
+
- test/commands_on_strings_test.rb
|
101
|
+
- test/commands_on_value_types_test.rb
|
102
|
+
- test/connection_handling_test.rb
|
103
|
+
- test/db/.gitkeep
|
104
|
+
- test/distributed_blocking_commands_test.rb
|
105
|
+
- test/distributed_commands_on_hashes_test.rb
|
106
|
+
- test/distributed_commands_on_hyper_log_log_test.rb
|
107
|
+
- test/distributed_commands_on_lists_test.rb
|
108
|
+
- test/distributed_commands_on_sets_test.rb
|
109
|
+
- test/distributed_commands_on_sorted_sets_test.rb
|
110
|
+
- test/distributed_commands_on_strings_test.rb
|
111
|
+
- test/distributed_commands_on_value_types_test.rb
|
112
|
+
- test/distributed_commands_requiring_clustering_test.rb
|
113
|
+
- test/distributed_connection_handling_test.rb
|
114
|
+
- test/distributed_internals_test.rb
|
115
|
+
- test/distributed_key_tags_test.rb
|
116
|
+
- test/distributed_persistence_control_commands_test.rb
|
117
|
+
- test/distributed_publish_subscribe_test.rb
|
118
|
+
- test/distributed_remote_server_control_commands_test.rb
|
119
|
+
- test/distributed_scripting_test.rb
|
120
|
+
- test/distributed_sorting_test.rb
|
121
|
+
- test/distributed_test.rb
|
122
|
+
- test/distributed_transactions_test.rb
|
123
|
+
- test/encoding_test.rb
|
124
|
+
- test/error_replies_test.rb
|
125
|
+
- test/fork_safety_test.rb
|
126
|
+
- test/helper.rb
|
127
|
+
- test/helper_test.rb
|
128
|
+
- test/internals_test.rb
|
129
|
+
- test/lint/blocking_commands.rb
|
130
|
+
- test/lint/hashes.rb
|
131
|
+
- test/lint/hyper_log_log.rb
|
132
|
+
- test/lint/lists.rb
|
133
|
+
- test/lint/sets.rb
|
134
|
+
- test/lint/sorted_sets.rb
|
135
|
+
- test/lint/strings.rb
|
136
|
+
- test/lint/value_types.rb
|
137
|
+
- test/persistence_control_commands_test.rb
|
138
|
+
- test/pipelining_commands_test.rb
|
139
|
+
- test/publish_subscribe_test.rb
|
140
|
+
- test/remote_server_control_commands_test.rb
|
141
|
+
- test/scanning_test.rb
|
142
|
+
- test/scripting_test.rb
|
143
|
+
- test/sentinel_command_test.rb
|
144
|
+
- test/sentinel_test.rb
|
145
|
+
- test/sorting_test.rb
|
146
|
+
- test/support/connection/hiredis.rb
|
147
|
+
- test/support/connection/ruby.rb
|
148
|
+
- test/support/connection/synchrony.rb
|
149
|
+
- test/support/redis_mock.rb
|
150
|
+
- test/support/wire/synchrony.rb
|
151
|
+
- test/support/wire/thread.rb
|
152
|
+
- test/synchrony_driver.rb
|
153
|
+
- test/test.conf.erb
|
154
|
+
- test/thread_safety_test.rb
|
155
|
+
- test/transactions_test.rb
|
156
|
+
- test/unknown_commands_test.rb
|
157
|
+
- test/url_param_test.rb
|
158
|
+
homepage: https://github.com/discourse/redis-rb
|
159
|
+
licenses:
|
160
|
+
- MIT
|
161
|
+
metadata: {}
|
162
|
+
post_install_message:
|
163
|
+
rdoc_options: []
|
164
|
+
require_paths:
|
165
|
+
- lib
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
requirements: []
|
177
|
+
rubyforge_project:
|
178
|
+
rubygems_version: 2.5.1
|
179
|
+
signing_key:
|
180
|
+
specification_version: 4
|
181
|
+
summary: A Ruby client library for Redis
|
182
|
+
test_files: []
|