Rename cache ttl to cache period

pull/2401/head
saneery 5 years ago
parent c2dec2ad27
commit e93b71c0f3
  1. 8
      apps/explorer/config/config.exs
  2. 2
      apps/explorer/lib/explorer/market/market_history_cache.ex

@ -18,7 +18,7 @@ config :explorer,
healthy_blocks_period: System.get_env("HEALTHY_BLOCKS_PERIOD") || :timer.minutes(5) healthy_blocks_period: System.get_env("HEALTHY_BLOCKS_PERIOD") || :timer.minutes(5)
average_block_period = average_block_period =
case Integer.parse(System.get_env("AVERAGE_BLOCK_PERIOD", "")) do case Integer.parse(System.get_env("AVERAGE_BLOCK_CACHE_PERIOD", "")) do
{secs, ""} -> :timer.seconds(secs) {secs, ""} -> :timer.seconds(secs)
_ -> :timer.minutes(30) _ -> :timer.minutes(30)
end end
@ -114,13 +114,13 @@ config :spandex_ecto, SpandexEcto.EctoLogger,
tracer: Explorer.Tracer, tracer: Explorer.Tracer,
otp_app: :explorer otp_app: :explorer
market_history_cache_ttl = market_history_cache_period =
case Integer.parse(System.get_env("MARKET_HISTORY_CACHE_TTL", "")) do case Integer.parse(System.get_env("MARKET_HISTORY_CACHE_PERIOD", "")) do
{secs, ""} -> :timer.seconds(secs) {secs, ""} -> :timer.seconds(secs)
_ -> :timer.hours(6) _ -> :timer.hours(6)
end end
config :explorer, Explorer.Market.MarketHistoryCache, ttl: market_history_cache_ttl config :explorer, Explorer.Market.MarketHistoryCache, period: market_history_cache_period
# Import environment specific config. This must remain at the bottom # Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above. # of this file so it overrides the configuration defined above.

@ -12,7 +12,7 @@ defmodule Explorer.Market.MarketHistoryCache do
@last_update_key :last_update @last_update_key :last_update
@history_key :history @history_key :history
# 6 hours # 6 hours
@cache_period Application.get_env(:explorer, __MODULE__)[:ttl] @cache_period Application.get_env(:explorer, __MODULE__)[:period]
@recent_days 30 @recent_days 30
def fetch do def fetch do

Loading…
Cancel
Save