redis-client 0.15.0 → 0.16.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 +5 -0
- data/Gemfile.lock +2 -2
- data/README.md +8 -8
- data/lib/redis_client/ruby_connection/buffered_io.rb +0 -4
- data/lib/redis_client/ruby_connection.rb +0 -7
- data/lib/redis_client/sentinel_config.rb +2 -2
- data/lib/redis_client/version.rb +1 -1
- data/lib/redis_client.rb +3 -4
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35ff65a4af6127cb60acff6a3d3b2d2e5e65ddeffc0e8e808b7dec90792697a6
|
|
4
|
+
data.tar.gz: 854f82d7548c5462b53ae29a637dc208cdc70b3399b28d0c61f38e02f073e37e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c9e8e564662e86f4e1a24ca9528a5d909a096218eaf62bd7b58838402db390e7bec65d79a43aa89a2b98d22f9645ca7e412ae2db4010dc4131cbf2133d2666f
|
|
7
|
+
data.tar.gz: c6400693a10e28e377bf52792ee54f41afb2b2c97ea49578a90eba767b6e3b6a7f37eaeaccf41a38a8222827f461f44aa0b1f75881084dc30a521e407508e277
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
redis-client (0.
|
|
4
|
+
redis-client (0.16.0)
|
|
5
5
|
connection_pool
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -19,7 +19,7 @@ GEM
|
|
|
19
19
|
ast (~> 2.4.1)
|
|
20
20
|
rainbow (3.1.1)
|
|
21
21
|
rake (13.0.6)
|
|
22
|
-
rake-compiler (1.2.
|
|
22
|
+
rake-compiler (1.2.5)
|
|
23
23
|
rake
|
|
24
24
|
redis (4.6.0)
|
|
25
25
|
regexp_parser (2.5.0)
|
data/README.md
CHANGED
|
@@ -42,7 +42,7 @@ redis.with do |r|
|
|
|
42
42
|
end
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
If you are working in a single
|
|
45
|
+
If you are working in a single-threaded environment, or wish to use your own connection pooling mechanism,
|
|
46
46
|
you can obtain a raw client with `#new_client`
|
|
47
47
|
|
|
48
48
|
```ruby
|
|
@@ -67,11 +67,11 @@ redis.call("GET", "mykey")
|
|
|
67
67
|
- `host`: The server hostname or IP address. Defaults to `"localhost"`.
|
|
68
68
|
- `port`: The server port. Defaults to `6379`.
|
|
69
69
|
- `path`: The path to a UNIX socket, if set `url`, `host` and `port` are ignored.
|
|
70
|
-
- `ssl`:
|
|
70
|
+
- `ssl`: Whether to connect using SSL or not.
|
|
71
71
|
- `ssl_params`: A configuration Hash passed to [`OpenSSL::SSL::SSLContext#set_params`](https://www.rubydoc.info/stdlib/openssl/OpenSSL%2FSSL%2FSSLContext:set_params), notable options include:
|
|
72
72
|
- `cert`: The path to the client certificate (e.g. `client.crt`).
|
|
73
73
|
- `key`: The path to the client key (e.g. `client.key`).
|
|
74
|
-
- `ca_file`: The certificate authority to use, useful for self
|
|
74
|
+
- `ca_file`: The certificate authority to use, useful for self-signed certificates (e.g. `ca.crt`),
|
|
75
75
|
- `db`: The database to select after connecting, defaults to `0`.
|
|
76
76
|
- `id` ID for the client connection, assigns name to current connection by sending `CLIENT SETNAME`.
|
|
77
77
|
- `username` Username to authenticate against server, defaults to `"default"`.
|
|
@@ -83,7 +83,7 @@ redis.call("GET", "mykey")
|
|
|
83
83
|
- `reconnect_attempts`: Specify how many times the client should retry to send queries. Defaults to `0`. Makes sure to read the [reconnection section](#reconnection) before enabling it.
|
|
84
84
|
- `circuit_breaker`: A Hash with circuit breaker configuration. Defaults to `nil`. See the [circuit breaker section](#circuit-breaker) for details.
|
|
85
85
|
- `protocol:` The version of the RESP protocol to use. Default to `3`.
|
|
86
|
-
- `custom`: A user
|
|
86
|
+
- `custom`: A user-owned value ignored by `redis-client` but available as `Config#custom`. This can be used to hold middleware configurations and other user-specific metadata.
|
|
87
87
|
|
|
88
88
|
### Sentinel support
|
|
89
89
|
|
|
@@ -344,7 +344,7 @@ end
|
|
|
344
344
|
```
|
|
345
345
|
|
|
346
346
|
*Note*: pubsub connections are stateful, as such they won't ever reconnect automatically.
|
|
347
|
-
The caller is
|
|
347
|
+
The caller is responsible for reconnecting if the connection is lost and to resubscribe to
|
|
348
348
|
all channels.
|
|
349
349
|
|
|
350
350
|
## Production
|
|
@@ -380,7 +380,7 @@ redis_config = RedisClient.config(middlewares: [AnotherRedisInstrumentation])
|
|
|
380
380
|
redis_config.new_client
|
|
381
381
|
```
|
|
382
382
|
|
|
383
|
-
If middlewares need a client
|
|
383
|
+
If middlewares need a client-specific configuration, `Config#custom` can be used
|
|
384
384
|
|
|
385
385
|
```ruby
|
|
386
386
|
module MyGlobalRedisInstrumentation
|
|
@@ -454,9 +454,9 @@ redis_config = RedisClient.config(reconnect_attempts: [0, 0.05, 0.1])
|
|
|
454
454
|
```
|
|
455
455
|
|
|
456
456
|
This configuration is generally used when the Redis server is expected to failover or recover relatively quickly and
|
|
457
|
-
that it's not really
|
|
457
|
+
that it's not really possible to continue without issuing the command.
|
|
458
458
|
|
|
459
|
-
When the Redis server is used as an ephemeral cache, circuit breakers are generally
|
|
459
|
+
When the Redis server is used as an ephemeral cache, circuit breakers are generally preferred.
|
|
460
460
|
|
|
461
461
|
### Circuit Breaker
|
|
462
462
|
|
|
@@ -10,7 +10,7 @@ class RedisClient
|
|
|
10
10
|
attr_reader :name
|
|
11
11
|
|
|
12
12
|
def initialize(sentinels:, role: :master, name: nil, url: nil, **client_config)
|
|
13
|
-
unless %i(master replica slave).include?(role)
|
|
13
|
+
unless %i(master replica slave).include?(role.to_sym)
|
|
14
14
|
raise ArgumentError, "Expected role to be either :master or :replica, got: #{role.inspect}"
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -43,7 +43,7 @@ class RedisClient
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
@sentinels = {}.compare_by_identity
|
|
46
|
-
@role = role
|
|
46
|
+
@role = role.to_sym
|
|
47
47
|
@mutex = Mutex.new
|
|
48
48
|
@config = nil
|
|
49
49
|
|
data/lib/redis_client/version.rb
CHANGED
data/lib/redis_client.rb
CHANGED
|
@@ -358,9 +358,8 @@ class RedisClient
|
|
|
358
358
|
self
|
|
359
359
|
end
|
|
360
360
|
|
|
361
|
-
def
|
|
362
|
-
|
|
363
|
-
self
|
|
361
|
+
def disable_reconnection(&block)
|
|
362
|
+
ensure_connected(retryable: false, &block)
|
|
364
363
|
end
|
|
365
364
|
|
|
366
365
|
def pipelined
|
|
@@ -623,7 +622,7 @@ class RedisClient
|
|
|
623
622
|
end
|
|
624
623
|
|
|
625
624
|
def ensure_connected(retryable: true)
|
|
626
|
-
|
|
625
|
+
close if !config.inherit_socket && @pid != PIDCache.pid
|
|
627
626
|
|
|
628
627
|
if @disable_reconnection
|
|
629
628
|
if block_given?
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: redis-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.16.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jean Boussier
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-08-
|
|
11
|
+
date: 2023-08-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: connection_pool
|
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
77
77
|
- !ruby/object:Gem::Version
|
|
78
78
|
version: '0'
|
|
79
79
|
requirements: []
|
|
80
|
-
rubygems_version: 3.
|
|
80
|
+
rubygems_version: 3.4.10
|
|
81
81
|
signing_key:
|
|
82
82
|
specification_version: 4
|
|
83
83
|
summary: Simple low-level client for Redis 6+
|