cache_store_redis 2.3.0.rc3-java → 2.4.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cache_store_redis/redis_connection_pool.rb +8 -18
- data/lib/cache_store_redis/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e785151124f1e0c4423a26acddbc7bea48f92655a63b2c3a3c33cc24d2b25493
|
4
|
+
data.tar.gz: 4b89904a6f316fce1181516a120654fd343568af1c12755636337e2c1e6137c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acf00267d8299b6365da2935cb2008b0c7d32d0262a61547d4249877038c051e41d5d34edeeccef16c4d0d5f2031a2d8500ab46498de147026a138e56310a33c
|
7
|
+
data.tar.gz: '085f3b234b92874c9181b194908b373627b81bf86616c52082c7e98f7b91d15275028cf360b1f299ef6e4c5c3bdc8eb13d71ae0e47166e4c7b6f0fb5c9a4b17d'
|
@@ -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.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- vaughanbrittonsage
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,9 +124,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- - "
|
127
|
+
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version:
|
129
|
+
version: '0'
|
130
130
|
requirements: []
|
131
131
|
rubygems_version: 3.3.26
|
132
132
|
signing_key:
|