alephant-broker 2.0.3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/alephant/broker/cache.rb +16 -17
- data/lib/alephant/broker/version.rb +1 -1
- metadata +69 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70f99d4f4a6e8be1fa904432ebc5c88582b798e4
|
4
|
+
data.tar.gz: 1d20ca33dea4ced011ed482e08f4f8ad026f874a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ffed8d1b703c047dd93c24a805f5a0da2a68377a413d5470334da27e07b044d7e85f8dd67da06bac7bc6acbebc8fcd97a830870a4fc8454636e1863ec22fad7
|
7
|
+
data.tar.gz: 2330d1a13a6c61515514bd04939ae9374f0819cd91bc74bf5c9493b7df44dc1207ad552deb8246c0783f49ea741dbc511cff26bc8f5342af754d95194445049a
|
@@ -4,7 +4,6 @@ require 'alephant/logger'
|
|
4
4
|
module Alephant
|
5
5
|
module Broker
|
6
6
|
module Cache
|
7
|
-
|
8
7
|
class Client
|
9
8
|
include Logger
|
10
9
|
|
@@ -20,6 +19,22 @@ module Alephant
|
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
22
|
+
def get(key, &block)
|
23
|
+
begin
|
24
|
+
result = @@client.get(versioned(key))
|
25
|
+
logger.info("Broker::Cache::Client#get key: #{key} - #{result ? 'hit' : 'miss'}")
|
26
|
+
result ? result : set(key, block.call)
|
27
|
+
rescue StandardError => e
|
28
|
+
block.call if block_given?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def set(key, value, ttl = nil)
|
33
|
+
value.tap { |o| @@client.set(versioned(key), o, ttl) }
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
23
38
|
def config_endpoint
|
24
39
|
Broker.config['elasticache_config_endpoint']
|
25
40
|
end
|
@@ -35,21 +50,6 @@ module Alephant
|
|
35
50
|
def cache_version
|
36
51
|
Broker.config['elasticache_cache_version']
|
37
52
|
end
|
38
|
-
|
39
|
-
def get(key, &block)
|
40
|
-
begin
|
41
|
-
result = @@client.get(versioned(key))
|
42
|
-
logger.info("Broker::Cache::Client#get key: #{key} - #{result ? 'hit' : 'miss'}")
|
43
|
-
result ? result : set(key, block.call)
|
44
|
-
rescue StandardError => e
|
45
|
-
block.call if block_given?
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def set(key, value)
|
50
|
-
value.tap { |o| @@client.set(versioned(key), o) }
|
51
|
-
end
|
52
|
-
|
53
53
|
end
|
54
54
|
|
55
55
|
class NullClient
|
@@ -59,7 +59,6 @@ module Alephant
|
|
59
59
|
value
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
63
62
|
end
|
64
63
|
end
|
65
64
|
end
|
metadata
CHANGED
@@ -1,267 +1,267 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant-broker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Jack
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
15
|
requirement: !ruby/object:Gem::Requirement
|
21
16
|
requirements:
|
22
17
|
- - '>='
|
23
18
|
- !ruby/object:Gem::Version
|
24
19
|
version: '0'
|
25
|
-
prerelease: false
|
26
20
|
type: :development
|
27
|
-
|
28
|
-
name: rspec-nc
|
21
|
+
prerelease: false
|
29
22
|
version_requirements: !ruby/object:Gem::Requirement
|
30
23
|
requirements:
|
31
24
|
- - '>='
|
32
25
|
- !ruby/object:Gem::Version
|
33
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-nc
|
34
29
|
requirement: !ruby/object:Gem::Requirement
|
35
30
|
requirements:
|
36
31
|
- - '>='
|
37
32
|
- !ruby/object:Gem::Version
|
38
33
|
version: '0'
|
39
|
-
prerelease: false
|
40
34
|
type: :development
|
41
|
-
|
42
|
-
name: guard
|
35
|
+
prerelease: false
|
43
36
|
version_requirements: !ruby/object:Gem::Requirement
|
44
37
|
requirements:
|
45
38
|
- - '>='
|
46
39
|
- !ruby/object:Gem::Version
|
47
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
44
|
requirements:
|
50
45
|
- - '>='
|
51
46
|
- !ruby/object:Gem::Version
|
52
47
|
version: '0'
|
53
|
-
prerelease: false
|
54
48
|
type: :development
|
55
|
-
|
56
|
-
name: guard-rspec
|
49
|
+
prerelease: false
|
57
50
|
version_requirements: !ruby/object:Gem::Requirement
|
58
51
|
requirements:
|
59
52
|
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-rspec
|
62
57
|
requirement: !ruby/object:Gem::Requirement
|
63
58
|
requirements:
|
64
59
|
- - '>='
|
65
60
|
- !ruby/object:Gem::Version
|
66
61
|
version: '0'
|
67
|
-
prerelease: false
|
68
62
|
type: :development
|
69
|
-
|
70
|
-
name: pry
|
63
|
+
prerelease: false
|
71
64
|
version_requirements: !ruby/object:Gem::Requirement
|
72
65
|
requirements:
|
73
66
|
- - '>='
|
74
67
|
- !ruby/object:Gem::Version
|
75
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
76
71
|
requirement: !ruby/object:Gem::Requirement
|
77
72
|
requirements:
|
78
73
|
- - '>='
|
79
74
|
- !ruby/object:Gem::Version
|
80
75
|
version: '0'
|
81
|
-
prerelease: false
|
82
76
|
type: :development
|
83
|
-
|
84
|
-
name: pry-remote
|
77
|
+
prerelease: false
|
85
78
|
version_requirements: !ruby/object:Gem::Requirement
|
86
79
|
requirements:
|
87
80
|
- - '>='
|
88
81
|
- !ruby/object:Gem::Version
|
89
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry-remote
|
90
85
|
requirement: !ruby/object:Gem::Requirement
|
91
86
|
requirements:
|
92
87
|
- - '>='
|
93
88
|
- !ruby/object:Gem::Version
|
94
89
|
version: '0'
|
95
|
-
prerelease: false
|
96
90
|
type: :development
|
97
|
-
|
98
|
-
name: pry-nav
|
91
|
+
prerelease: false
|
99
92
|
version_requirements: !ruby/object:Gem::Requirement
|
100
93
|
requirements:
|
101
94
|
- - '>='
|
102
95
|
- !ruby/object:Gem::Version
|
103
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry-nav
|
104
99
|
requirement: !ruby/object:Gem::Requirement
|
105
100
|
requirements:
|
106
101
|
- - '>='
|
107
102
|
- !ruby/object:Gem::Version
|
108
103
|
version: '0'
|
109
|
-
prerelease: false
|
110
104
|
type: :development
|
111
|
-
|
112
|
-
name: rake-rspec
|
105
|
+
prerelease: false
|
113
106
|
version_requirements: !ruby/object:Gem::Requirement
|
114
107
|
requirements:
|
115
108
|
- - '>='
|
116
109
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake-rspec
|
118
113
|
requirement: !ruby/object:Gem::Requirement
|
119
114
|
requirements:
|
120
115
|
- - '>='
|
121
116
|
- !ruby/object:Gem::Version
|
122
117
|
version: 0.0.2
|
123
|
-
prerelease: false
|
124
118
|
type: :development
|
125
|
-
|
126
|
-
name: bundler
|
119
|
+
prerelease: false
|
127
120
|
version_requirements: !ruby/object:Gem::Requirement
|
128
121
|
requirements:
|
129
|
-
- -
|
122
|
+
- - '>='
|
130
123
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
124
|
+
version: 0.0.2
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: bundler
|
132
127
|
requirement: !ruby/object:Gem::Requirement
|
133
128
|
requirements:
|
134
129
|
- - ~>
|
135
130
|
- !ruby/object:Gem::Version
|
136
131
|
version: '1.5'
|
137
|
-
prerelease: false
|
138
132
|
type: :development
|
139
|
-
|
140
|
-
name: rake
|
133
|
+
prerelease: false
|
141
134
|
version_requirements: !ruby/object:Gem::Requirement
|
142
135
|
requirements:
|
143
|
-
- -
|
136
|
+
- - ~>
|
144
137
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
138
|
+
version: '1.5'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rake
|
146
141
|
requirement: !ruby/object:Gem::Requirement
|
147
142
|
requirements:
|
148
143
|
- - '>='
|
149
144
|
- !ruby/object:Gem::Version
|
150
145
|
version: '0'
|
151
|
-
prerelease: false
|
152
146
|
type: :development
|
153
|
-
|
154
|
-
name: rack-test
|
147
|
+
prerelease: false
|
155
148
|
version_requirements: !ruby/object:Gem::Requirement
|
156
149
|
requirements:
|
157
150
|
- - '>='
|
158
151
|
- !ruby/object:Gem::Version
|
159
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rack-test
|
160
155
|
requirement: !ruby/object:Gem::Requirement
|
161
156
|
requirements:
|
162
157
|
- - '>='
|
163
158
|
- !ruby/object:Gem::Version
|
164
159
|
version: '0'
|
165
|
-
prerelease: false
|
166
160
|
type: :development
|
167
|
-
|
168
|
-
name: alephant-lookup
|
161
|
+
prerelease: false
|
169
162
|
version_requirements: !ruby/object:Gem::Requirement
|
170
163
|
requirements:
|
171
164
|
- - '>='
|
172
165
|
- !ruby/object:Gem::Version
|
173
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: alephant-lookup
|
174
169
|
requirement: !ruby/object:Gem::Requirement
|
175
170
|
requirements:
|
176
171
|
- - '>='
|
177
172
|
- !ruby/object:Gem::Version
|
178
173
|
version: '0'
|
179
|
-
prerelease: false
|
180
174
|
type: :runtime
|
181
|
-
|
182
|
-
name: alephant-cache
|
175
|
+
prerelease: false
|
183
176
|
version_requirements: !ruby/object:Gem::Requirement
|
184
177
|
requirements:
|
185
178
|
- - '>='
|
186
179
|
- !ruby/object:Gem::Version
|
187
180
|
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: alephant-cache
|
188
183
|
requirement: !ruby/object:Gem::Requirement
|
189
184
|
requirements:
|
190
185
|
- - '>='
|
191
186
|
- !ruby/object:Gem::Version
|
192
187
|
version: '0'
|
193
|
-
prerelease: false
|
194
188
|
type: :runtime
|
195
|
-
|
196
|
-
name: alephant-logger
|
189
|
+
prerelease: false
|
197
190
|
version_requirements: !ruby/object:Gem::Requirement
|
198
191
|
requirements:
|
199
192
|
- - '>='
|
200
193
|
- !ruby/object:Gem::Version
|
201
194
|
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: alephant-logger
|
202
197
|
requirement: !ruby/object:Gem::Requirement
|
203
198
|
requirements:
|
204
199
|
- - '>='
|
205
200
|
- !ruby/object:Gem::Version
|
206
201
|
version: '0'
|
207
|
-
prerelease: false
|
208
202
|
type: :runtime
|
209
|
-
|
210
|
-
name: alephant-sequencer
|
203
|
+
prerelease: false
|
211
204
|
version_requirements: !ruby/object:Gem::Requirement
|
212
205
|
requirements:
|
213
206
|
- - '>='
|
214
207
|
- !ruby/object:Gem::Version
|
215
208
|
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: alephant-sequencer
|
216
211
|
requirement: !ruby/object:Gem::Requirement
|
217
212
|
requirements:
|
218
213
|
- - '>='
|
219
214
|
- !ruby/object:Gem::Version
|
220
215
|
version: '0'
|
221
|
-
prerelease: false
|
222
216
|
type: :runtime
|
223
|
-
|
224
|
-
name: dalli-elasticache
|
217
|
+
prerelease: false
|
225
218
|
version_requirements: !ruby/object:Gem::Requirement
|
226
219
|
requirements:
|
227
220
|
- - '>='
|
228
221
|
- !ruby/object:Gem::Version
|
229
222
|
version: '0'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: dalli-elasticache
|
230
225
|
requirement: !ruby/object:Gem::Requirement
|
231
226
|
requirements:
|
232
227
|
- - '>='
|
233
228
|
- !ruby/object:Gem::Version
|
234
229
|
version: '0'
|
235
|
-
prerelease: false
|
236
230
|
type: :runtime
|
237
|
-
|
238
|
-
name: pmap
|
231
|
+
prerelease: false
|
239
232
|
version_requirements: !ruby/object:Gem::Requirement
|
240
233
|
requirements:
|
241
234
|
- - '>='
|
242
235
|
- !ruby/object:Gem::Version
|
243
236
|
version: '0'
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: pmap
|
244
239
|
requirement: !ruby/object:Gem::Requirement
|
245
240
|
requirements:
|
246
241
|
- - '>='
|
247
242
|
- !ruby/object:Gem::Version
|
248
243
|
version: '0'
|
249
|
-
prerelease: false
|
250
244
|
type: :runtime
|
251
|
-
|
252
|
-
name: faraday
|
245
|
+
prerelease: false
|
253
246
|
version_requirements: !ruby/object:Gem::Requirement
|
254
247
|
requirements:
|
255
248
|
- - '>='
|
256
249
|
- !ruby/object:Gem::Version
|
257
250
|
version: '0'
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: faraday
|
258
253
|
requirement: !ruby/object:Gem::Requirement
|
259
254
|
requirements:
|
260
255
|
- - '>='
|
261
256
|
- !ruby/object:Gem::Version
|
262
257
|
version: '0'
|
263
|
-
prerelease: false
|
264
258
|
type: :runtime
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - '>='
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '0'
|
265
265
|
description: Brokers requests for alephant components
|
266
266
|
email:
|
267
267
|
- stevenmajack@gmail.com
|
@@ -313,7 +313,7 @@ homepage: https://github.com/BBC-News/alephant-broker
|
|
313
313
|
licenses:
|
314
314
|
- MIT
|
315
315
|
metadata: {}
|
316
|
-
post_install_message:
|
316
|
+
post_install_message:
|
317
317
|
rdoc_options: []
|
318
318
|
require_paths:
|
319
319
|
- lib
|
@@ -328,9 +328,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
328
328
|
- !ruby/object:Gem::Version
|
329
329
|
version: '0'
|
330
330
|
requirements: []
|
331
|
-
rubyforge_project:
|
332
|
-
rubygems_version: 2.
|
333
|
-
signing_key:
|
331
|
+
rubyforge_project:
|
332
|
+
rubygems_version: 2.0.14
|
333
|
+
signing_key:
|
334
334
|
specification_version: 4
|
335
335
|
summary: Brokers requests for alephant components
|
336
336
|
test_files:
|