alephant-broker 1.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/lib/alephant/broker/cache.rb +10 -2
- data/lib/alephant/broker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffbec731bdb53ec91a9c0d1b5194f3e45219e578
|
4
|
+
data.tar.gz: 6ad479c7351251f7d160b5550f57e6ffc3767504
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3038bc90069fd8a25168adb91aef80a7f5ed1388da0a6d726ea2d43d25abfa7d15522aff542097ab1372aae0e10a1c7d56bbb6f27888d83b99c92416ca02c6ac
|
7
|
+
data.tar.gz: 3daadef81b28b9b6d7400d08703210f34ab7e8c8a4ae9dc3df72b664b5c72c438188f1d3d8c4ce85ca39c1a16d712ec9aeb15e73a0367ee2125d4da732ead062
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
jruby-1.7
|
1
|
+
jruby-1.7
|
@@ -28,9 +28,17 @@ module Alephant
|
|
28
28
|
Broker.config['elasticache_ttl'] || DEFAULT_TTL
|
29
29
|
end
|
30
30
|
|
31
|
+
def versioned(key)
|
32
|
+
[key, cache_version].compact.join('_')
|
33
|
+
end
|
34
|
+
|
35
|
+
def cache_version
|
36
|
+
Broker.config['elasticache_cache_version']
|
37
|
+
end
|
38
|
+
|
31
39
|
def get(key, &block)
|
32
40
|
begin
|
33
|
-
result = @@client.get(key)
|
41
|
+
result = @@client.get(versioned(key))
|
34
42
|
logger.info("Broker::Cache::Client#get key: #{key} - #{result ? 'hit' : 'miss'}")
|
35
43
|
result ? result : set(key, block.call)
|
36
44
|
rescue StandardError => e
|
@@ -39,7 +47,7 @@ module Alephant
|
|
39
47
|
end
|
40
48
|
|
41
49
|
def set(key, value)
|
42
|
-
value.tap { |o| @@client.set(key, o) }
|
50
|
+
value.tap { |o| @@client.set(versioned(key), o) }
|
43
51
|
end
|
44
52
|
|
45
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant-broker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Jack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|