Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions lib/cms/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@ defmodule CMS.Repo do
end
end

@decorate cacheable(
cache: @cache,
key: "cms.repo|whats-happening",
on_error: :nothing,
opts: [ttl: @ttl]
)
def do_whats_happening do
@cms_api.view("/cms/whats-happening", [])
end
Expand Down
10 changes: 10 additions & 0 deletions lib/dotcom_web/controllers/page_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ defmodule DotcomWeb.PageController do

use Dotcom.Gettext.Sigils
use DotcomWeb, :controller
use Nebulex.Caching.Decorators

import DotcomWeb.CMSHelpers, only: [cms_route_to_class: 1]
import CMS.Repo, only: [photo: 0]
Expand All @@ -23,6 +24,9 @@ defmodule DotcomWeb.PageController do

@subway_status_cache Application.compile_env!(:dotcom, :system_status_cache_modules)[:subway]

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

def index(conn, _params) do
{promoted, remainder} = whats_happening_items()
banner = banner()
Expand Down Expand Up @@ -77,6 +81,12 @@ defmodule DotcomWeb.PageController do
|> Enum.map(&add_utm_url/1)
end

@decorate cacheable(
cache: @cache,
key: "PageController.whats_happening_items",
on_error: :nothing,
opts: [ttl: @ttl]
)
@spec whats_happening_items :: whats_happening_set
defp whats_happening_items do
Repo.whats_happening()
Expand Down
Loading