heartcheck-cache 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,3 @@
1
+ require 'securerandom'
1
2
  require 'heartcheck'
2
3
  require 'heartcheck/checks/cache'
@@ -2,6 +2,6 @@
2
2
  module Heartcheck
3
3
  # gem version
4
4
  module Cache
5
- VERSION = '1.0.1'
5
+ VERSION = '1.0.2'
6
6
  end
7
7
  end
@@ -24,7 +24,7 @@ module Heartcheck
24
24
  #
25
25
  # @return [Bollean]
26
26
  def set?(con)
27
- con.set('check_test', 'heartcheck')
27
+ con.set(unique_check_key, 'heartcheck')
28
28
  rescue
29
29
  false
30
30
  end
@@ -35,7 +35,7 @@ module Heartcheck
35
35
  #
36
36
  # @return [Bollean]
37
37
  def get?(con)
38
- con.get('check_test') == 'heartcheck'
38
+ con.get(unique_check_key) == 'heartcheck'
39
39
  rescue
40
40
  false
41
41
  end
@@ -46,7 +46,7 @@ module Heartcheck
46
46
  #
47
47
  # @return [Bollean]
48
48
  def delete?(con)
49
- con.delete('check_test')
49
+ con.delete(unique_check_key)
50
50
  rescue
51
51
  false
52
52
  end
@@ -61,6 +61,15 @@ module Heartcheck
61
61
  def custom_error(name, key_error)
62
62
  @errors << "#{name} fails to #{key_error}"
63
63
  end
64
+
65
+ # generate an unique redis key
66
+ # It's necessary to run concurrent application instances/checks using a
67
+ # shared memcache
68
+ #
69
+ # @return [String]
70
+ def unique_check_key
71
+ @unique_check_key ||= SecureRandom.hex
72
+ end
64
73
  end
65
74
  end
66
75
  end
metadata CHANGED
@@ -1,155 +1,172 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heartcheck-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Locaweb
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-02-29 00:00:00.000000000 Z
12
+ date: 2017-09-28 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: net-telnet
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - "~>"
19
+ - - ~>
18
20
  - !ruby/object:Gem::Version
19
21
  version: 0.1.1
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - "~>"
27
+ - - ~>
25
28
  - !ruby/object:Gem::Version
26
29
  version: 0.1.1
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: heartcheck
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - ">="
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: 1.0.0
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - ">="
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: 1.0.0
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: dalli
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - ">="
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - ">="
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: pry-nav
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - "~>"
67
+ - - ~>
60
68
  - !ruby/object:Gem::Version
61
69
  version: 0.2.0
62
- - - ">="
70
+ - - ! '>='
63
71
  - !ruby/object:Gem::Version
64
72
  version: 0.2.4
65
73
  type: :development
66
74
  prerelease: false
67
75
  version_requirements: !ruby/object:Gem::Requirement
76
+ none: false
68
77
  requirements:
69
- - - "~>"
78
+ - - ~>
70
79
  - !ruby/object:Gem::Version
71
80
  version: 0.2.0
72
- - - ">="
81
+ - - ! '>='
73
82
  - !ruby/object:Gem::Version
74
83
  version: 0.2.4
75
84
  - !ruby/object:Gem::Dependency
76
85
  name: rspec
77
86
  requirement: !ruby/object:Gem::Requirement
87
+ none: false
78
88
  requirements:
79
- - - "~>"
89
+ - - ~>
80
90
  - !ruby/object:Gem::Version
81
91
  version: 3.1.0
82
- - - ">="
92
+ - - ! '>='
83
93
  - !ruby/object:Gem::Version
84
94
  version: 3.1.0
85
95
  type: :development
86
96
  prerelease: false
87
97
  version_requirements: !ruby/object:Gem::Requirement
98
+ none: false
88
99
  requirements:
89
- - - "~>"
100
+ - - ~>
90
101
  - !ruby/object:Gem::Version
91
102
  version: 3.1.0
92
- - - ">="
103
+ - - ! '>='
93
104
  - !ruby/object:Gem::Version
94
105
  version: 3.1.0
95
106
  - !ruby/object:Gem::Dependency
96
107
  name: rubocop
97
108
  requirement: !ruby/object:Gem::Requirement
109
+ none: false
98
110
  requirements:
99
- - - "~>"
111
+ - - ~>
100
112
  - !ruby/object:Gem::Version
101
113
  version: 0.27.0
102
- - - ">="
114
+ - - ! '>='
103
115
  - !ruby/object:Gem::Version
104
116
  version: 0.27.1
105
117
  type: :development
106
118
  prerelease: false
107
119
  version_requirements: !ruby/object:Gem::Requirement
120
+ none: false
108
121
  requirements:
109
- - - "~>"
122
+ - - ~>
110
123
  - !ruby/object:Gem::Version
111
124
  version: 0.27.0
112
- - - ">="
125
+ - - ! '>='
113
126
  - !ruby/object:Gem::Version
114
127
  version: 0.27.1
115
128
  - !ruby/object:Gem::Dependency
116
129
  name: yard
117
130
  requirement: !ruby/object:Gem::Requirement
131
+ none: false
118
132
  requirements:
119
- - - "~>"
133
+ - - ~>
120
134
  - !ruby/object:Gem::Version
121
135
  version: 0.8.0
122
- - - ">="
136
+ - - ! '>='
123
137
  - !ruby/object:Gem::Version
124
138
  version: 0.8.7
125
139
  type: :development
126
140
  prerelease: false
127
141
  version_requirements: !ruby/object:Gem::Requirement
142
+ none: false
128
143
  requirements:
129
- - - "~>"
144
+ - - ~>
130
145
  - !ruby/object:Gem::Version
131
146
  version: 0.8.0
132
- - - ">="
147
+ - - ! '>='
133
148
  - !ruby/object:Gem::Version
134
149
  version: 0.8.7
135
150
  - !ruby/object:Gem::Dependency
136
151
  name: redcarpet
137
152
  requirement: !ruby/object:Gem::Requirement
153
+ none: false
138
154
  requirements:
139
- - - "~>"
155
+ - - ~>
140
156
  - !ruby/object:Gem::Version
141
157
  version: 3.2.0
142
- - - ">="
158
+ - - ! '>='
143
159
  - !ruby/object:Gem::Version
144
160
  version: 3.2.2
145
161
  type: :development
146
162
  prerelease: false
147
163
  version_requirements: !ruby/object:Gem::Requirement
164
+ none: false
148
165
  requirements:
149
- - - "~>"
166
+ - - ~>
150
167
  - !ruby/object:Gem::Version
151
168
  version: 3.2.0
152
- - - ">="
169
+ - - ! '>='
153
170
  - !ruby/object:Gem::Version
154
171
  version: 3.2.2
155
172
  description: Plugin to check cache connection in heartcheck.
@@ -159,32 +176,33 @@ executables: []
159
176
  extensions: []
160
177
  extra_rdoc_files: []
161
178
  files:
179
+ - lib/heartcheck/checks/cache.rb
162
180
  - lib/heartcheck/cache.rb
163
181
  - lib/heartcheck/cache/version.rb
164
- - lib/heartcheck/checks/cache.rb
165
182
  homepage: http://developer.locaweb.com.br
166
183
  licenses:
167
184
  - MIT
168
- metadata: {}
169
185
  post_install_message:
170
186
  rdoc_options: []
171
187
  require_paths:
172
188
  - lib
173
189
  required_ruby_version: !ruby/object:Gem::Requirement
190
+ none: false
174
191
  requirements:
175
- - - ">="
192
+ - - ! '>='
176
193
  - !ruby/object:Gem::Version
177
194
  version: '0'
178
195
  required_rubygems_version: !ruby/object:Gem::Requirement
196
+ none: false
179
197
  requirements:
180
- - - ">="
198
+ - - ! '>='
181
199
  - !ruby/object:Gem::Version
182
200
  version: '0'
183
201
  requirements: []
184
202
  rubyforge_project:
185
- rubygems_version: 2.5.1
203
+ rubygems_version: 1.8.23.2
186
204
  signing_key:
187
- specification_version: 4
205
+ specification_version: 3
188
206
  summary: A cache checker.
189
207
  test_files: []
190
208
  has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 1ce4fc8759eec4d41c96c7b19df8b6d96d2ba842
4
- data.tar.gz: 3bf61f2803ef7ccded9e94f7c2b49ee9f1444dd4
5
- SHA512:
6
- metadata.gz: 2c85f7a91c9d705e7988d254972d8636452c3a558ede2cd8ae250262b6e7dd2ff5daee409701aa2bdb5edf8a438aa7a51fbb7631913c8c5c3fb8c649c69ac5e4
7
- data.tar.gz: 73d08e316156f6976ac81ff83f507c3486a351075a05bc7f76485557a1b73adda4d0941e097100939d25bc97115de775181662144f15a4c18c80031dd095c286