exchange-rates 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/exchange_rates/rate.rb +1 -1
- data/lib/exchange_rates/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5135c81812d1e95366d3b3c1dd1b17a007c4a4ea9642d2cf6322410eeec2d64
|
4
|
+
data.tar.gz: 255160ee5f78ab244bc125c4d61ca3e02ecc810a26891c7f03574b28f32d0a02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bfa5b3d17faa76defff63c458a3429dda2545b5de4df070336c0bc57536c49c847f199269cee514e3b1aae111af3995b812f8deccb6dd945b21fd8fb47a74fb
|
7
|
+
data.tar.gz: c20420d833474f8b0ff83261078d9db36f27b6ed8bac87e77e240f912e92b2b68b7e5c470585efe77860c3827f0151e9549b4b0bb7d043d89ecb20a97717841d
|
data/lib/exchange_rates/rate.rb
CHANGED
@@ -26,7 +26,7 @@ module ExchangeRates
|
|
26
26
|
|
27
27
|
def self.get_rate(currency)
|
28
28
|
return 1 if currency == BASE_CURRENCY
|
29
|
-
cached = Rails.cache.fetch("#{currency.downcase}_to_#{BASE_CURRENCY.downcase}",
|
29
|
+
cached = Rails.cache.fetch("#{currency.downcase}_to_#{BASE_CURRENCY.downcase}", expires_in: 1.day, race_condition_ttl: 5) do
|
30
30
|
where(from_currency: currency).first.rate_to_base_currency
|
31
31
|
end
|
32
32
|
cached || where(from_currency: currency).first.rate_to_base_currency
|