redis-client 0.10.0 → 0.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27142ef61a44133a72e2a087afc39986ebcfe5fae30a7ee5f6eb3f702ef35ad2
4
- data.tar.gz: f078880a52dec2f62d3b68188cfea8108ec433742f2f7e697def7a7bece332ac
3
+ metadata.gz: 7f28d878a923f684e1ddade2a735339dc7ae55d3091b3d21b812fcf1b232b8fe
4
+ data.tar.gz: 5cc874fa373695185c4b5f040e8368be66550596838faadab8b3e57e45f8c0b0
5
5
  SHA512:
6
- metadata.gz: 76c7b23cb0ba419fdb9505e5cd4eb58c1c6d38d2e2fcd82778429b346dfa02a94ce4a9077c28252d8c71d1667cc45270bfc0790190e42b0d37341493bbb105f5
7
- data.tar.gz: 071ec50fabaa72512101d0f408154e432e5f9950927607d8d6bcf8c7f3d5d4c9f49f40de3a24aa6957019751a598b70ae9db525002c03d7beb05312fc082e053
6
+ metadata.gz: ba5313f360e675d1e751f6c5138290facab7e3ea043d5328b14556050ceb44155947ad670077e22b1fb04b2aa5738a6d6b77454b5d31e0a4641c1e705f3ba545
7
+ data.tar.gz: 45463aae9b8d188cc5d1a2c0604962001bafcd266fb526fecb7ddee5081fbc28a9a5a27b8a09525b515d69266cf7740424a50408e62cf2361debe1ffb52b3d9e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Unreleased
2
2
 
3
+ # 0.11.0
4
+
5
+ - hiredis: do not eagerly close the connection on read timeout, let the caller decide if a timeout is final.
6
+ - Add `Config#custom` to store configuration metadata. It can be used for per server middleware configuration.
7
+
3
8
  # 0.10.0
4
9
 
5
10
  - 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.10.0)
4
+ redis-client (0.11.0)
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.21)
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.
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class RedisClient
4
- VERSION = "0.10.0"
4
+ VERSION = "0.11.0"
5
5
  end
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.10.0
4
+ version: 0.11.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: 2022-10-10 00:00:00.000000000 Z
11
+ date: 2022-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool