kredis 1.6.0 → 1.6.1

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: 15ed6996059d28937ffa4f43a35e53d1e8fbc1894a30446575d9c00c390cd838
4
- data.tar.gz: 296f80ea7719d69334d50240c9fce5969df4f8d976800013167c1fb0ebe6a0b3
3
+ metadata.gz: f90d8ba8eadeb9cc6dbd2ca4bbb8532629281595e5a1feccd42487b98f248e67
4
+ data.tar.gz: 3d5e2768e7647d27bb004bc7167f9b35b97702bdcc3e3f6f76032abd3b85bb5d
5
5
  SHA512:
6
- metadata.gz: cae34ebe3f21fe7c0e9cc0da5fc14bdc0d15931436bf7f07c552c14090489806990779ffd219be054f050468c809e23bf79302365f59f2dfced4b6a054ad352c
7
- data.tar.gz: 96513897d1badc12f4fc6b2e51e017958f7e5eeaa5730d06bcb9d9a12d71ae09a4eb8ce2661e70a70647f4c4d7e5543a30451ab64d290b91de20d47602f30398
6
+ metadata.gz: 590e5baac4b4a2c85c4867f6ee55d4598c3b21e9c9b22961556626f59e8b17524cc4e4e9040f9109d30671ba4b615b074edcad5723df459f75a10dd1da956a23
7
+ data.tar.gz: 8ad76868f04ac0c0828485f2e03ce93fc8514eb32e2661028adcbc6ff9866f6016d26530b6af30f8df15009723e01797fc913084bb6bcb219f36558db7ed2768
data/README.md CHANGED
@@ -245,6 +245,8 @@ Additional configurations can be added under `config/redis/*.yml` and referenced
245
245
 
246
246
  Kredis passes the configuration to `Redis.new` to establish the connection. See the [Redis documentation](https://github.com/redis/redis-rb) for other configuration options.
247
247
 
248
+ If you don't have `config/redis/shared.yml` (or use another named configuration), Kredis will default to look in env for `REDIS_URL`, then fallback to a default URL of `redis://127.0.0.1:6379/0`.
249
+
248
250
  ### Redis support
249
251
 
250
252
  Kredis works with Redis server 4.0+, with the [Redis Ruby](https://github.com/redis/redis-rb) client version 4.2+.
@@ -3,13 +3,22 @@
3
3
  require "redis"
4
4
 
5
5
  module Kredis::Connections
6
+ DEFAULT_REDIS_URL = "redis://127.0.0.1:6379/0"
7
+ DEFAULT_REDIS_TIMEOUT = 1
8
+
6
9
  mattr_accessor :connections, default: Hash.new
7
10
  mattr_accessor :configurator
8
11
  mattr_accessor :connector, default: ->(config) { Redis.new(config) }
9
12
 
10
13
  def configured_for(name)
11
14
  connections[name] ||= Kredis.instrument :meta, message: "Connected to #{name}" do
12
- connector.call configurator.config_for("redis/#{name}")
15
+ if configurator.root.join("config/redis/#{name}.yml").exist?
16
+ connector.call configurator.config_for("redis/#{name}")
17
+ elsif name == :shared
18
+ Redis.new url: ENV.fetch("REDIS_URL", DEFAULT_REDIS_URL), timeout: DEFAULT_REDIS_TIMEOUT
19
+ else
20
+ raise "No configuration found for #{name}"
21
+ end
13
22
  end
14
23
  end
15
24
 
@@ -1,3 +1,3 @@
1
1
  module Kredis
2
- VERSION = "1.6.0"
2
+ VERSION = "1.6.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kredis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Timm Hansen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-10-19 00:00:00.000000000 Z
12
+ date: 2023-12-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
- rubygems_version: 3.4.20
135
+ rubygems_version: 3.4.14
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: Higher-level data structures built on Redis.