cache_store_redis 2.1.1 → 2.2.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: 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,13 +62,13 @@ 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
|
-
expire_value = expiry_int.positive? ? expiry_int : DEFAULT_TTL
|
71
|
+
expire_value = expiry_int.positive? ? expiry_int : Integer(DEFAULT_TTL)
|
76
72
|
|
77
73
|
with_client do |client|
|
78
74
|
client.multi do
|
@@ -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|
|
@@ -127,7 +123,7 @@ class RedisCacheStore
|
|
127
123
|
# @return [Boolean] True or False to specify if the key exists in the cache store.
|
128
124
|
def exist?(key)
|
129
125
|
with_client do |client|
|
130
|
-
client.exists(build_key(key))
|
126
|
+
!client.exists(build_key(key)).zero?
|
131
127
|
end
|
132
128
|
end
|
133
129
|
|
@@ -140,6 +136,10 @@ class RedisCacheStore
|
|
140
136
|
end
|
141
137
|
end
|
142
138
|
|
139
|
+
alias write set
|
140
|
+
alias read get
|
141
|
+
alias delete remove
|
142
|
+
|
143
143
|
private
|
144
144
|
|
145
145
|
def serialize(object)
|
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.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
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry-byebug
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +95,7 @@ dependencies:
|
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: oj
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
@@ -95,7 +109,7 @@ dependencies:
|
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: redis
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
@@ -142,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
156
|
- !ruby/object:Gem::Version
|
143
157
|
version: '0'
|
144
158
|
requirements: []
|
145
|
-
rubygems_version: 3.
|
159
|
+
rubygems_version: 3.3.5
|
146
160
|
signing_key:
|
147
161
|
specification_version: 4
|
148
162
|
summary: This is the redis cache_store implementation.
|