Skip to content

Commit

Permalink
add one key and set TTL to four hours (#1918)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyshull authored Mar 14, 2024
1 parent 8e40c33 commit 6a94082
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/cms/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule CMS.Repo do

@cache Application.compile_env!(:dotcom, :cache)
@cms_api Application.compile_env!(:dotcom, :cms_api)
@ttl :timer.hours(1)
@ttl :timer.hours(4)

@spec get_page(String.t(), map) :: Page.t() | {:error, API.error()}
def get_page(path, query_params \\ %{}) do
Expand Down Expand Up @@ -74,8 +74,9 @@ defmodule CMS.Repo do

@decorate cacheable(
cache: @cache,
key: "cms.repo|events",
on_error: :nothing,
opts: [ttl: 60_000]
opts: [ttl: @ttl]
)
def events(opts \\ []) do
case @cms_api.view("/cms/events", opts) do
Expand Down Expand Up @@ -104,7 +105,7 @@ defmodule CMS.Repo do
cache: @cache,
key: "cms.repo|whats-happening",
on_error: :nothing,
opts: [ttl: 60_000]
opts: [ttl: @ttl]
)
def whats_happening() do
case @cms_api.view("/cms/whats-happening", []) do
Expand All @@ -124,7 +125,7 @@ defmodule CMS.Repo do
cache: @cache,
key: "cms.repo|important-notices",
on_error: :nothing,
opts: [ttl: 60_000]
opts: [ttl: @ttl]
)
def do_banner() do
case @cms_api.view("/cms/important-notices", []) do
Expand Down

0 comments on commit 6a94082

Please sign in to comment.