cache_store_redis 2.3.0 → 2.4.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: eadb74cd784d47a8d9a96fa0be04390cf9a1fe869455884f0bd4eb243ba8d9e4
4
- data.tar.gz: b3543a9dcc691ef17813348e6165973ce1946d23a38808982e267e39f20c07d5
3
+ metadata.gz: b7b394a68b522c377b14ccddb12bc628589cfc6f35516ddbca03b1ca208a4467
4
+ data.tar.gz: 6feb5ece32867b089c2961c135c0a8980b2b0fde07f24dac88cdbf89227473c0
5
5
  SHA512:
6
- metadata.gz: 05d25aca238aea95d84f7f463eb115c4db24e148b338b3d414f7c45ea57a58bc4cb96dcb01229343ea227641d1ad9ae442419ebc2d15d1a5bfde7537201cac1a
7
- data.tar.gz: 85b1b4f55c37b52a4bb0302379f7041a9046804c390a1f12fd7f327a3849cee08235c658dd4534b85e9e69fdb59806cc4752ce52733464a70a1ebee81633cb9a
6
+ metadata.gz: f7ed49f94e18461886a549ac6384ea069abcc0b6baa39023541b1e42d0e5e32fadb9f9bb9fdd5b95c35c9c67640704e80c3473caec3d5b448df270e8523d3425
7
+ data.tar.gz: b01daca80a0a9f47977279928432912e0bc3771f0ef69b53665d903b0ac49ff961833be273e92725a94d6e793f7f0a6112e5f1c46e63a843035f1160796c9129
@@ -14,7 +14,7 @@ class OptionalRedisCacheStore
14
14
  def configure(
15
15
  host = 'localhost',
16
16
  port = 6379,
17
- db = 'default',
17
+ db = 0,
18
18
  password = nil,
19
19
  driver: nil,
20
20
  url: nil,
@@ -12,29 +12,23 @@ class RedisConnectionPool
12
12
  loop do
13
13
  sleep(1)
14
14
  @mutex.synchronize do
15
- connections.select { |con| con.expired? }.each do |con|
16
- con.close
17
- end
15
+ connections.select(&:expired?).each(&:close)
18
16
  end
19
17
  end
20
18
  end
21
19
  end
22
20
 
23
21
  # This method is called to get the namespace for redis keys.
24
- def namespace
25
- @namespace
26
- end
22
+ attr_reader :namespace
27
23
 
28
24
  # This method is called to get the idle connection queue for this pool.
29
- def queue
30
- @queue
31
- end
25
+ attr_reader :queue
32
26
 
33
27
  # This method is called to fetch a connection from the queue or create a new connection if no idle connections
34
28
  # are available.
35
29
  def fetch_connection
36
30
  queue.pop(true)
37
- rescue
31
+ rescue StandardError
38
32
  RedisConnection.new(config)
39
33
  end
40
34
 
@@ -51,9 +45,7 @@ class RedisConnectionPool
51
45
 
52
46
  # This method is called to checkin a connection to the pool after use.
53
47
  def check_in(connection)
54
- if connection.expired?
55
- connection.close
56
- end
48
+ connection.close if connection.expired?
57
49
  @mutex.synchronize do
58
50
  connections.push(connection)
59
51
  queue.push(connection)
@@ -63,15 +55,13 @@ class RedisConnectionPool
63
55
  # This method is called to use a connection from this pool.
64
56
  def with_connection
65
57
  connection = check_out
66
- return yield connection.client
58
+ yield connection.client
67
59
  ensure
68
- check_in(connection)
60
+ check_in(connection) if connection
69
61
  end
70
62
 
71
63
  # This method is called to get an array of idle connections in this pool.
72
- def connections
73
- @connections
74
- end
64
+ attr_reader :connections
75
65
 
76
66
  def shutdown
77
67
  connections.each do |con|
@@ -1,3 +1,3 @@
1
1
  module CacheStoreRedis
2
- VERSION = '2.3.0'
2
+ VERSION = '2.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cache_store_redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-26 00:00:00.000000000 Z
11
+ date: 2024-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler