cache_store_redis 2.2.0 → 2.2.1
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_cache_store.rb +10 -14
- data/lib/cache_store_redis/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ac2b7e94e04f13213f7c012bab907ca6987b3c1a0399dac8a3a2743885ba43b
|
4
|
+
data.tar.gz: c621d64fe04f7c0168b86260fc33a8637780b0a68f3b396f24cbc200077a1383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d221218738c6f3037f97725c67c4ff7c1e93b6848c1cb10c0012f75c27f1c35441588bc6d3447f8342971a4806720d6cf0faf43f8d2b0111e64e9f32c31abd12
|
7
|
+
data.tar.gz: 368af535622a69e737adebf8fe4a444657de30b444156a523719843e73d8459d5a64adb1f976a1883bd162b61f72fb3a4648458f4e711919e4083db9a66c1f47
|
@@ -15,14 +15,12 @@ class RedisCacheStore
|
|
15
15
|
@enable_stats = false
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
@connection_pool
|
20
|
-
end
|
18
|
+
attr_reader :connection_pool
|
21
19
|
|
22
20
|
# This method is called to configure the connection to the cache store.
|
23
21
|
def configure(host = 'localhost',
|
24
22
|
port = 6379,
|
25
|
-
db =
|
23
|
+
db = 0,
|
26
24
|
password = nil,
|
27
25
|
driver: nil,
|
28
26
|
url: nil,
|
@@ -49,12 +47,10 @@ class RedisCacheStore
|
|
49
47
|
def clean
|
50
48
|
connection_pool.shutdown
|
51
49
|
end
|
52
|
-
|
50
|
+
alias shutdown clean
|
53
51
|
|
54
|
-
def with_client
|
55
|
-
connection_pool.with_connection
|
56
|
-
yield connection
|
57
|
-
end
|
52
|
+
def with_client(&block)
|
53
|
+
connection_pool.with_connection(&block)
|
58
54
|
end
|
59
55
|
|
60
56
|
# This method is called to set a value within this cache store by it's key.
|
@@ -66,10 +62,10 @@ class RedisCacheStore
|
|
66
62
|
k = build_key(key)
|
67
63
|
|
68
64
|
v = if value.nil? || (value.is_a?(String) && value.strip.empty?)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
65
|
+
nil
|
66
|
+
else
|
67
|
+
serialize(value)
|
68
|
+
end
|
73
69
|
|
74
70
|
expiry_int = Integer(expires_in)
|
75
71
|
expire_value = expiry_int.positive? ? expiry_int : Integer(DEFAULT_TTL)
|
@@ -91,7 +87,7 @@ class RedisCacheStore
|
|
91
87
|
# @param &block [Block] This block is provided to hydrate this cache store with the value for the request key
|
92
88
|
# when it is not found.
|
93
89
|
# @return [Object] The value for the specified unique key within the cache store.
|
94
|
-
def get(key, expires_in = 0
|
90
|
+
def get(key, expires_in = 0)
|
95
91
|
k = build_key(key)
|
96
92
|
|
97
93
|
value = with_client do |client|
|
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.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaughanbrittonsage
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
|
-
rubygems_version: 3.
|
159
|
+
rubygems_version: 3.3.5
|
160
160
|
signing_key:
|
161
161
|
specification_version: 4
|
162
162
|
summary: This is the redis cache_store implementation.
|