heartcheck-cache 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/heartcheck/cache.rb +2 -0
- data/lib/heartcheck/cache/version.rb +7 -0
- data/lib/heartcheck/checks/cache.rb +66 -0
- metadata +182 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5f9be888ade5ce0f2deff1222d55ccc0b74322ed
|
4
|
+
data.tar.gz: 9af00772d74e299c2071304dfc28fae2024d9142
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 55892f0c7c3800803520bd1e7e47950d574b8ec040ccd4db52a4d5712853de7d4d105572aeffe1a285ef38260969a3a2e4de8f319956e631d84548e65950626b
|
7
|
+
data.tar.gz: 93b0329f77c0980239c3ca020c5a56e24308ffc74472fdcdc6ab46753e31ec569da5ddc13d96c727c47237dea577ac659715864a38b56849c00ac49ded26e5ce
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Heartcheck
|
2
|
+
module Checks
|
3
|
+
# Check for a cache service
|
4
|
+
# Base is set in heartcheck gem
|
5
|
+
class Cache < Base
|
6
|
+
# validate each service
|
7
|
+
#
|
8
|
+
# @retun [void]
|
9
|
+
def validate
|
10
|
+
services.each do |service|
|
11
|
+
connection = service[:connection]
|
12
|
+
|
13
|
+
append_error(service[:name], :set) unless set?(connection)
|
14
|
+
append_error(service[:name], :get) unless get?(connection)
|
15
|
+
append_error(service[:name], :delete) unless delete?(connection)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
# test if can write on cache
|
22
|
+
#
|
23
|
+
# @param con [Cache] an instance of cache
|
24
|
+
#
|
25
|
+
# @return [Bollean]
|
26
|
+
def set?(con)
|
27
|
+
con.set('check_test', 'heartcheck')
|
28
|
+
rescue
|
29
|
+
false
|
30
|
+
end
|
31
|
+
|
32
|
+
# test if can read on cache
|
33
|
+
#
|
34
|
+
# @param con [Cache] an instance of cache
|
35
|
+
#
|
36
|
+
# @return [Bollean]
|
37
|
+
def get?(con)
|
38
|
+
con.get('check_test') == 'heartcheck'
|
39
|
+
rescue
|
40
|
+
false
|
41
|
+
end
|
42
|
+
|
43
|
+
# test if can delete on cache
|
44
|
+
#
|
45
|
+
# @param con [Cache] an instance of cache
|
46
|
+
#
|
47
|
+
# @return [Bollean]
|
48
|
+
def delete?(con)
|
49
|
+
con.delete('check_test')
|
50
|
+
rescue
|
51
|
+
false
|
52
|
+
end
|
53
|
+
|
54
|
+
# customize the error message
|
55
|
+
# It's called in Heartcheck::Checks::Base#append_error
|
56
|
+
#
|
57
|
+
# @param name [String] An identifier of service
|
58
|
+
# @param key_error [Symbol] name of action
|
59
|
+
#
|
60
|
+
# @return [void]
|
61
|
+
def custom_error(name, key_error)
|
62
|
+
@errors << "#{name} fails to #{key_error}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
metadata
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: heartcheck-cache
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Locaweb
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: heartcheck
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.0
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: dalli
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: pry-nav
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.2.0
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.2.4
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 0.2.0
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.2.4
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: rspec
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 3.1.0
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 3.1.0
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 3.1.0
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 3.1.0
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: rubocop
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.27.0
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.27.1
|
97
|
+
type: :development
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.27.0
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 0.27.1
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
name: yard
|
109
|
+
requirement: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - "~>"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 0.8.0
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 0.8.7
|
117
|
+
type: :development
|
118
|
+
prerelease: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 0.8.0
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 0.8.7
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: redcarpet
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - "~>"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 3.2.0
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: 3.2.2
|
137
|
+
type: :development
|
138
|
+
prerelease: false
|
139
|
+
version_requirements: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 3.2.0
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 3.2.2
|
147
|
+
description: Plugin to check cache connection in heartcheck.
|
148
|
+
email:
|
149
|
+
- desenvolvedores@locaweb.com.br
|
150
|
+
executables: []
|
151
|
+
extensions: []
|
152
|
+
extra_rdoc_files: []
|
153
|
+
files:
|
154
|
+
- lib/heartcheck/cache.rb
|
155
|
+
- lib/heartcheck/cache/version.rb
|
156
|
+
- lib/heartcheck/checks/cache.rb
|
157
|
+
homepage: http://developer.locaweb.com.br
|
158
|
+
licenses:
|
159
|
+
- MIT
|
160
|
+
metadata: {}
|
161
|
+
post_install_message:
|
162
|
+
rdoc_options: []
|
163
|
+
require_paths:
|
164
|
+
- lib
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
requirements: []
|
176
|
+
rubyforge_project:
|
177
|
+
rubygems_version: 2.4.5
|
178
|
+
signing_key:
|
179
|
+
specification_version: 4
|
180
|
+
summary: A cache checker.
|
181
|
+
test_files: []
|
182
|
+
has_rdoc:
|