Skip to content

Cache User#personal_projects_count in Redis

This method is called on various pages to figure out how many projects one can still create. While this query itself only takes roughly 2 milliseconds it does get called on many pages.

A simple way to get rid of this is to cache the number (in raw form using Rails.cache.fetch(..., raw: true)) in Redis and refresh it whenever the user creates a personal project.