Add action cache and cache now playing requests

This commit is contained in:
2023-11-02 20:43:59 +11:00
parent e0c03ac5ae
commit 85d3b9214e
9 changed files with 62 additions and 14 deletions

View File

@@ -1,10 +1,13 @@
require "time_math"
module Adamantium
module Actions
module RecentlyPlayed
class Index < Action
include Deps["views.recently_played.index"]
include Deps["views.recently_played.index", "view_cache.cacher"]
def handle(req, res)
res.render index
res.body = cacher.call(key: "recently_played", content: index.call.to_str, expiry: TimeMath.min.advance(Time.now, +10))
end
end
end