Skip to main content

GoRails Screencast suggestion: Caching

Site Feedback • Asked by Sascha M.

Hi there,

just a quick suggestion. I'm at a stage where I'm struggling with Caching. Since you haven't covered this topic yet I would be very happy if you do, especially Database query caching.

Greetings!


I do have an episode on Fragment caching that is helpful: https://gorails.com/episodes/fragment-caching-and-oembed

The main reason I probably won't cover query caching is because in order for your website to be always up-to-date, you'll have to query the database to find the most recent records. If you cache queries, you won't know that there are new records since you didn't make another query.

The way fragment caching helps is you make the query (which only takes a couple milliseconds) and then you look at the results to see if there are HTML fragments cached for those results. If so, you just send over the HTML fragment as a response instead. This is a lot simpler and gives you the same benefit in performance.


Thanks for that. I'll give it a try.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.