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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a20e83924522b6a80a8042132e7fd59511a7a635
4
- data.tar.gz: 651101ad39d0187fba1d05c5d4857ad54d7ce36d
3
+ metadata.gz: 09d0e75893a974d9e12e29700f1eb69c60fd3ac1
4
+ data.tar.gz: 430258b027448444156d28f0a35819e17575759a
5
5
  SHA512:
6
- metadata.gz: e8d9c2010e6c9b70e20690c38ab6938c0e97c42179d689be18228a776327c3a4deda6f89e1562196537d6f160833e8e8a51a5d8abd7f3a36315ba2a21c9e6439
7
- data.tar.gz: 63124e6a099f40062775a0fbd24c72be79e587406e6d4cc6b3fcc162a66fdf0c39c0c5bf67bea3908803cd0a85e967ae8c0597049223713f37145d6911f43cca
6
+ metadata.gz: 8b48cedb4a1067f4d2ec315f64b5478387d09674311fe8d1ee58ccaac6748ed6a2b6ae3eea7a28dc158782770ed529e2515750cf10b92e7dd1acbcb8cc7e59b1
7
+ data.tar.gz: 9622c3b9691e77c3ba8a3b4b6d455c845a90dc995d890a618c5089bb3c010d540e0001b6e3541dbe16a2a4d7f8a986c5b16325abbb1e30351370e3bd6b86bd37
@@ -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-elasticache"
36
+ spec.add_runtime_dependency "dalli"
37
37
  spec.add_runtime_dependency "crimp"
38
38
  end
@@ -1,4 +1,4 @@
1
- require "dalli-elasticache"
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
- @elasticache ||= ::Dalli::ElastiCache.new(config_endpoint, { :expires_in => ttl })
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"
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Lookup
3
- VERSION = "2.1.0".freeze
3
+ VERSION = "2.2.0".freeze
4
4
  end
5
5
  end
@@ -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/218c835cec343537589dbf1619532e4d',
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
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
43
+ expect(Dalli::Client).to receive(:new).and_return(cache_client)
42
44
 
43
- expect_any_instance_of(Dalli::Client).to receive(:get)
44
- expect_any_instance_of(Dalli::Client).to receive(:set)
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
- expect_any_instance_of(Dalli::ElastiCache).to receive(:client).and_return(Dalli::Client.new)
67
+ expect(Dalli::Client).to receive(:new).and_return(cache_client)
66
68
 
67
- expect_any_instance_of(Dalli::Client).to receive(:get)
68
- .with("table_name/id/218c835cec343537589dbf1619532e4d/0")
69
+ expect(cache_client).to receive(:get)
70
+ .with("table_name/id/7ef6e03f709c7e6b1c87bcf908bc5e0e/0")
69
71
  .and_return(lookup_location)
70
- expect_any_instance_of(Dalli::Client).to_not receive(:set)
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/7e0c33c476b1089500d5f172102ec03e",
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.1.0
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-05-16 00:00:00.000000000 Z
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-elasticache
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.12
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.