Use redis as a cache store

This commit is contained in:
2024-03-16 19:00:52 +11:00
parent e385e6782e
commit 546c51ed4f
12 changed files with 82 additions and 27 deletions

View File

@@ -4,7 +4,10 @@ module Main
class Index < Action
include Deps["views.posts.index"]
def handle(req, res)
res.render index, query: req.params[:q]
res.body = cache(key: "posts_index",
params: [req.params[:q]],
content_proc: ->(q) { res.render index, query: q })
res.status = 200
end
end
end