Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8722607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:27:09+00:00 2026-06-13T07:27:09+00:00

The question is based on 2 articles: – Basecamp Next by DHH from 37signals

  • 0

The question is based on 2 articles:
– Basecamp Next by DHH from 37signals
– Advanced Caching in Rails by Adam Hawkins

I’m a little bit confused about the performance implications of using Russian doll caching, Specifically:

  1. When using auto expiring keys it seems like every request will result in an access to the database to fetch the object timestamp – am I missing something? (I understand that in the best case scenario you have to do that only for the top level key in the hierarchy, but still …)

  2. In the 1st article they cache a todo list, as well as every todo item. Caching the list makes perfect sense as it saves a lot of work (DB query for all the items). But why cache the individual items? You are already going to the database to get the Item timestamp, so what exactly are you saving? Generating a few html lines?

  3. In the 2nd article Adam caches chunks of the view like this:
    cache [post, 'main-content'] …
    cache [post, 'comments']
    When a comment is added it changes the time stamp of post, and therefor invalidates both entires. However, main-content hasn’t changed – you don’t want to regenerate it!!! How would one go about invalidating only comments. (That’s actually a very common user case – a model that has a few logically independent parts: the object itself, the different associations, data in some other store, etc. )

To me it seems like Russian doll caching makes sense only when you have a deep hierarchy of nested object.(in basecamp you have project->todos list -> todo -> items list). However, if you have a shallow hierarchy, it’s better to just do the invalidation yourself.

Any feedback would be appreciated!
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:27:09+00:00Added an answer on June 13, 2026 at 7:27 am
    1. The top-level does need to hit the database. You can avoid this by storing the timestamp in a separate cache entry, keyed by model and id. One of the commenters on article 1 (Manuel F. Lara) suggested the same: “Is there another cache like projects/15-time where you always have the last timestamp for the projects list?”

    2. I think you’re right about the “lowest” level in the nesting. You might need to do some testing to see the relative performance of DB access vs rendering the tiny partial.

    3. Another good point. According to the rails docs, if you pass a symbol to :touch it will update that attribute in addition to updated_at – maybe there’s a way to skip changing the Post#updated_at and only update a column like comments_updated_at. Then you can use the latter for caching. But if you’re trying to avoid DB access, you’ll have to store yet another cache key for this timestamp (like in #1 above).

    I guess you have to decide whether all this is worth the trouble to you. The 2 articles show simple, contrived examples to teach the principles. In an app with complex associations, the “generational” caching method may be more manageable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a question based on: Trying to get tag-it to work with an
This is a further question based on this answer: How can I implement a
I have a three part question based on a dataframe (df is example rows)
So, my second question based off of this application I'm teaching myself Objective C
This question is based on my previous question which I got a working answer
This question is based on the thread . I have the shell function function
This question is based on this thread . Is [---] a comment in Git
This question is based on this thread . I am interested in how Git
This question is based on this thread . The code function man() { man
This question is based on this thread in Meta . I would like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.