From 3b32cbc2d977141be2d768cfab31941a052409ff Mon Sep 17 00:00:00 2001 From: Anthony Shull Date: Fri, 5 Jan 2024 14:55:48 -0600 Subject: [PATCH] cache a few more entities --- apps/cms/lib/repo.ex | 10 ++++++++++ config/runtime.exs | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/cms/lib/repo.ex b/apps/cms/lib/repo.ex index f95811a428..8b20e7bad4 100644 --- a/apps/cms/lib/repo.ex +++ b/apps/cms/lib/repo.ex @@ -62,6 +62,11 @@ defmodule CMS.Repo do end end + @decorate cacheable( + cache: @cache, + on_error: :nothing, + opts: [ttl: 60_000] + ) def do_news_entry_by(opts) do case @cms_api.view("/cms/news", opts) do {:ok, api_data} -> Enum.map(api_data, &NewsEntry.from_api/1) @@ -69,6 +74,11 @@ defmodule CMS.Repo do end end + @decorate cacheable( + cache: @cache, + on_error: :nothing, + opts: [ttl: 60_000] + ) def events(opts \\ []) do case @cms_api.view("/cms/events", opts) do {:ok, api_data} -> Enum.map(api_data, &Event.from_api/1) diff --git a/config/runtime.exs b/config/runtime.exs index 47dcf1d9dc..92643226e1 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -14,8 +14,7 @@ if config_env() == :prod do configuration_endpoints: [ conn_opts: [ host: redis_host, - port: 6379, - timeout: 15_000 + port: 6379 ] ] ],