alephant-lookup 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/alephant-lookup.gemspec +1 -1
- data/lib/alephant/lookup/lookup_cache.rb +2 -3
- data/lib/alephant/lookup/version.rb +1 -1
- data/spec/lookup_spec.rb +11 -9
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09d0e75893a974d9e12e29700f1eb69c60fd3ac1
|
4
|
+
data.tar.gz: 430258b027448444156d28f0a35819e17575759a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b48cedb4a1067f4d2ec315f64b5478387d09674311fe8d1ee58ccaac6748ed6a2b6ae3eea7a28dc158782770ed529e2515750cf10b92e7dd1acbcb8cc7e59b1
|
7
|
+
data.tar.gz: 9622c3b9691e77c3ba8a3b4b6d455c845a90dc995d890a618c5089bb3c010d540e0001b6e3541dbe16a2a4d7f8a986c5b16325abbb1e30351370e3bd6b86bd37
|
data/alephant-lookup.gemspec
CHANGED
@@ -33,6 +33,6 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_runtime_dependency "alephant-logger"
|
34
34
|
spec.add_runtime_dependency "alephant-support"
|
35
35
|
|
36
|
-
spec.add_runtime_dependency "dalli
|
36
|
+
spec.add_runtime_dependency "dalli"
|
37
37
|
spec.add_runtime_dependency "crimp"
|
38
38
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require "dalli
|
1
|
+
require "dalli"
|
2
2
|
require "alephant/logger"
|
3
3
|
|
4
4
|
module Alephant
|
@@ -14,8 +14,7 @@ module Alephant
|
|
14
14
|
@config = config
|
15
15
|
|
16
16
|
unless config_endpoint.nil?
|
17
|
-
@
|
18
|
-
@client ||= @elasticache.client
|
17
|
+
@client ||= ::Dalli::Client.new(config_endpoint, { :expires_in => ttl })
|
19
18
|
else
|
20
19
|
logger.debug "Alephant::LookupCache::#initialize: No config endpoint, NullClient used"
|
21
20
|
logger.metric "NoConfigEndpoint"
|
data/spec/lookup_spec.rb
CHANGED
@@ -31,17 +31,19 @@ describe Alephant::Lookup do
|
|
31
31
|
},
|
32
32
|
:key_condition_expression => 'component_key = :component_key AND batch_version = :batch_version',
|
33
33
|
:expression_attribute_values => {
|
34
|
-
':component_key' => 'id/
|
34
|
+
':component_key' => 'id/7ef6e03f709c7e6b1c87bcf908bc5e0e',
|
35
35
|
':batch_version' => 0 # @TODO: Verify if this is nil as this would be 0
|
36
36
|
}
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
40
|
+
let(:cache_client) { Dalli::Client.new }
|
41
|
+
|
40
42
|
it "queries DynamoDb and returns a location when not in cache" do
|
41
|
-
|
43
|
+
expect(Dalli::Client).to receive(:new).and_return(cache_client)
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
+
expect(cache_client).to receive(:get)
|
46
|
+
expect(cache_client).to receive(:set)
|
45
47
|
|
46
48
|
expect_any_instance_of(Aws::DynamoDB::Client)
|
47
49
|
.to receive(:query)
|
@@ -62,12 +64,12 @@ describe Alephant::Lookup do
|
|
62
64
|
it "reads location from the cache when in cache" do
|
63
65
|
lookup_location = Alephant::Lookup::LookupLocation.new("id", {:variant => "foo"}, 0, "/location")
|
64
66
|
|
65
|
-
|
67
|
+
expect(Dalli::Client).to receive(:new).and_return(cache_client)
|
66
68
|
|
67
|
-
|
68
|
-
.with("table_name/id/
|
69
|
+
expect(cache_client).to receive(:get)
|
70
|
+
.with("table_name/id/7ef6e03f709c7e6b1c87bcf908bc5e0e/0")
|
69
71
|
.and_return(lookup_location)
|
70
|
-
|
72
|
+
expect(cache_client).to_not receive(:set)
|
71
73
|
|
72
74
|
expect_any_instance_of(Aws::DynamoDB::Client).to_not receive(:query)
|
73
75
|
|
@@ -94,7 +96,7 @@ describe Alephant::Lookup do
|
|
94
96
|
expect(lookup_table)
|
95
97
|
.to receive(:write)
|
96
98
|
.with(
|
97
|
-
"id/
|
99
|
+
"id/c1d9f50f86825a1a2302ec2449c17196",
|
98
100
|
"0",
|
99
101
|
"/location"
|
100
102
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant-lookup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BBC News
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -193,7 +193,7 @@ dependencies:
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
|
-
name: dalli
|
196
|
+
name: dalli
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
199
|
- - ">="
|
@@ -266,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
266
|
version: '0'
|
267
267
|
requirements: []
|
268
268
|
rubyforge_project:
|
269
|
-
rubygems_version: 2.6.
|
269
|
+
rubygems_version: 2.6.14
|
270
270
|
signing_key:
|
271
271
|
specification_version: 4
|
272
272
|
summary: Lookup a location in S3 using DynamoDB.
|