Static assets are fingerprinted by the rails pipeline and cached via Cloudflare.
To enable caching in dev:
bin/rails dev:cache
We use redis for the cache store (rails doc.) Redis is already used for background workers and using the same reduces operational complexity. The preference is to use the hiredis
gem for performance reasons.
The biggest page in need of caching is the bracket list post tip off. This is fairly static data but some of the values are computed. The brackets are not paginated so all are shown.
Both Tournament
and Bracket
decision_team_slots
can be cached using ActiveRecord’s ` cache_key_with_version` which takes updated_at into account for the object.
Likewise, Bracket.sorted_four
is based solely on decision_team_slots
and can be cached.
These are calculations in bracket that should update both on bracket and tournament updated_at.