cache_store_redis 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eadb74cd784d47a8d9a96fa0be04390cf9a1fe869455884f0bd4eb243ba8d9e4
4
- data.tar.gz: b3543a9dcc691ef17813348e6165973ce1946d23a38808982e267e39f20c07d5
3
+ metadata.gz: 8ac7810373ca95d92bcde9c745ac1bbef9851800ba4031f37b5565144a27e84e
4
+ data.tar.gz: 5fa2928508a259ddb26c53cd8913f519238ec1b53d66478c4849e6e69375fe94
5
5
  SHA512:
6
- metadata.gz: 05d25aca238aea95d84f7f463eb115c4db24e148b338b3d414f7c45ea57a58bc4cb96dcb01229343ea227641d1ad9ae442419ebc2d15d1a5bfde7537201cac1a
7
- data.tar.gz: 85b1b4f55c37b52a4bb0302379f7041a9046804c390a1f12fd7f327a3849cee08235c658dd4534b85e9e69fdb59806cc4752ce52733464a70a1ebee81633cb9a
6
+ metadata.gz: 95c5a67dd789d509f79ed5f8c22da224b817da063051bb5cbdfb713874c53837fc501fea27221c6bff1da52393023a5c47a1aeefa82ea76fd1a0c219c508a6f9
7
+ data.tar.gz: 89e660289c2f6412858bcadd35b89410ccba1c5d85aea45740024a5015c6f14734d3d48d67723202ce9b05375f577d3e95d0c6fd71cdd0593fa6a5425ca67610
@@ -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.0'
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.0
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-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler