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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7b394a68b522c377b14ccddb12bc628589cfc6f35516ddbca03b1ca208a4467
|
4
|
+
data.tar.gz: 6feb5ece32867b089c2961c135c0a8980b2b0fde07f24dac88cdbf89227473c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7ed49f94e18461886a549ac6384ea069abcc0b6baa39023541b1e42d0e5e32fadb9f9bb9fdd5b95c35c9c67640704e80c3473caec3d5b448df270e8523d3425
|
7
|
+
data.tar.gz: b01daca80a0a9f47977279928432912e0bc3771f0ef69b53665d903b0ac49ff961833be273e92725a94d6e793f7f0a6112e5f1c46e63a843035f1160796c9129
|
@@ -12,29 +12,23 @@ class RedisConnectionPool
|
|
12
12
|
loop do
|
13
13
|
sleep(1)
|
14
14
|
@mutex.synchronize do
|
15
|
-
connections.select
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
73
|
-
@connections
|
74
|
-
end
|
64
|
+
attr_reader :connections
|
75
65
|
|
76
66
|
def shutdown
|
77
67
|
connections.each do |con|
|
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.
|
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-
|
11
|
+
date: 2024-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|