redis-client 0.10.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +2 -2
- data/README.md +21 -0
- data/lib/redis_client/config.rb +5 -2
- data/lib/redis_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ded07d814692a3e286f61a38a3d8129ef35189659124e73fd3e24e4e53a6a08b
|
4
|
+
data.tar.gz: 021c3dc9bf79717313a9f41e6bc29973cafbfe08ba15b2eb2b8560228939752b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52ebda137196361b56487d014cdbf5f188cd8822d92f955aeb39ee9fdea448051e38be2e68bf60616cdbeec1df942c25472a5d71e6b6c139ef96b1286db94d32
|
7
|
+
data.tar.gz: 495caeef04270d289eb58a5a1f0f52f19414db8d3efa0554edea041d165a3e14a33337156fa28c55c56fbee29b5683347d871fb7f84f79fea02371d1e0f605ce
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
- hiredis: Workaround a compilation bug with Xcode 14.0, Fix: #58
|
4
|
+
- Accept `URI` instances as `uri` parameter.
|
5
|
+
|
6
|
+
# 0.11.0
|
7
|
+
|
8
|
+
- hiredis: do not eagerly close the connection on read timeout, let the caller decide if a timeout is final.
|
9
|
+
- Add `Config#custom` to store configuration metadata. It can be used for per server middleware configuration.
|
10
|
+
|
3
11
|
# 0.10.0
|
4
12
|
|
5
13
|
- Added instance scoped middlewares. See: #53
|
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.11.1)
|
5
5
|
connection_pool
|
6
6
|
|
7
7
|
GEM
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
rubocop-minitest (0.19.1)
|
39
39
|
rubocop (>= 0.90, < 2.0)
|
40
40
|
ruby-progressbar (1.11.0)
|
41
|
-
stackprof (0.2.
|
41
|
+
stackprof (0.2.22)
|
42
42
|
toxiproxy (2.0.2)
|
43
43
|
unicode-display_width (2.2.0)
|
44
44
|
|
data/README.md
CHANGED
@@ -82,6 +82,7 @@ redis.call("GET", "mykey")
|
|
82
82
|
- `write_timeout`: The write timeout, takes precedence over the general timeout when sending commands to the server.
|
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
|
- `protocol:` The version of the RESP protocol to use. Default to `3`.
|
85
|
+
- `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 metadatas.
|
85
86
|
|
86
87
|
### Sentinel support
|
87
88
|
|
@@ -374,6 +375,26 @@ redis_config = RedisClient.config(middlewares: [AnotherRedisInstrumentation])
|
|
374
375
|
redis_config.new_client
|
375
376
|
```
|
376
377
|
|
378
|
+
If middlewares need a client specific configuration, `Config#custom` can be used
|
379
|
+
|
380
|
+
```ruby
|
381
|
+
module MyGlobalRedisInstrumentation
|
382
|
+
def connect(redis_config)
|
383
|
+
MyMonitoringService.instrument("redis.connect", tags: redis_config.custom[:tags]) { super }
|
384
|
+
end
|
385
|
+
|
386
|
+
def call(command, redis_config)
|
387
|
+
MyMonitoringService.instrument("redis.query", tags: redis_config.custom[:tags]) { super }
|
388
|
+
end
|
389
|
+
|
390
|
+
def call_pipelined(commands, redis_config)
|
391
|
+
MyMonitoringService.instrument("redis.pipeline", tags: redis_config.custom[:tags]) { super }
|
392
|
+
end
|
393
|
+
end
|
394
|
+
RedisClient.register(MyGlobalRedisInstrumentation)
|
395
|
+
|
396
|
+
redis_config = RedisClient.config(custom: { tags: { "environment": Rails.env }})
|
397
|
+
```
|
377
398
|
### Timeouts
|
378
399
|
|
379
400
|
The client allows you to configure connect, read, and write timeouts.
|
data/lib/redis_client/config.rb
CHANGED
@@ -14,7 +14,7 @@ class RedisClient
|
|
14
14
|
module Common
|
15
15
|
attr_reader :db, :password, :id, :ssl, :ssl_params, :command_builder, :inherit_socket,
|
16
16
|
:connect_timeout, :read_timeout, :write_timeout, :driver, :connection_prelude, :protocol,
|
17
|
-
:middlewares_stack
|
17
|
+
:middlewares_stack, :custom
|
18
18
|
|
19
19
|
alias_method :ssl?, :ssl
|
20
20
|
|
@@ -28,6 +28,7 @@ class RedisClient
|
|
28
28
|
write_timeout: timeout,
|
29
29
|
connect_timeout: timeout,
|
30
30
|
ssl: nil,
|
31
|
+
custom: {},
|
31
32
|
ssl_params: nil,
|
32
33
|
driver: nil,
|
33
34
|
protocol: 3,
|
@@ -50,6 +51,8 @@ class RedisClient
|
|
50
51
|
|
51
52
|
@driver = driver ? RedisClient.driver(driver) : RedisClient.default_driver
|
52
53
|
|
54
|
+
@custom = custom
|
55
|
+
|
53
56
|
@client_implementation = client_implementation
|
54
57
|
@protocol = protocol
|
55
58
|
unless protocol == 2 || protocol == 3
|
@@ -151,7 +154,7 @@ class RedisClient
|
|
151
154
|
**kwargs
|
152
155
|
)
|
153
156
|
if url
|
154
|
-
uri = URI
|
157
|
+
uri = URI(url)
|
155
158
|
kwargs[:ssl] = uri.scheme == "rediss" unless kwargs.key?(:ssl)
|
156
159
|
|
157
160
|
kwargs[:username] ||= uri.user if uri.password && !uri.user.empty?
|
data/lib/redis_client/version.rb
CHANGED
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.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|