Questions tagged [cache-digests]

Cache digests are a better way to handle fragment caching. It’s based on a Russian Doll scheme, meaning, when you have nested cached fragments and the nested content changes, only expire the cache for that content reusing the rest of the cache.

The cache-digest is a technique that could be used with template so called Template digest.Template digest that's added to the cache key is computed by taking an md5 of the contents of the entire template file. This ensures that your caches will automatically expire when you change the template file.

Tutorial

How key-based cache expiration works -

13 questions
11
votes
1 answer

Why do my self-referential templates break cache digest calculation in the console and rake but not in the server?

I have two partials which refer to one another. When I calculate nested dependencies in the console likes so (with some debug code outputting which template is being loaded): finder =…
John Bachir
  • 22,495
  • 29
  • 154
  • 227
6
votes
1 answer

Rails Russian Doll Caching and N+1

From what i understand of Russian doll caching in Rails it would be detrimental to eager load related objects or object lists when we are doing RDC (Russian Doll Caching) because in RDC we just load the top level object from the database, and look…
3
votes
1 answer

Rails cache_digests and conditionals

When we cache a partial in rails using cache digests, how does the conditional logic in the partial get handled? Does it cache the full template and later apply the conditionals so that the right json/html can be served to the right user?
Pratik Khadloya
  • 12,509
  • 11
  • 81
  • 106
3
votes
1 answer

Issues using Russian Doll Caching with Template Inheritance

I have been using both Template Inheritance and Russian Doll Caching (using the cache_digests gem) independently of one another in select portions of a fairly complex Rails application, with much success. I am having difficulty using the two…
2
votes
2 answers

Warming Up Cache Digests Overnight

We have a Rails 3.2 website which is fairly large with thousands of URLs. We implemented Cache_Digests gem for Russian Doll caching. It is working well. We want to further optimize by warming up the cache overnight so that user gets a better…
2
votes
0 answers

Rails 4 redirect links to ip address on Redis

I have an interesting problem. I use Russian-doll cache (cache_digests) on Rails 4 with Redis. After a period time, most of the links on pages change like this: "domain/url" to "server_ip/url" It's fixed when I flush Redis. How can I solve this…
2
votes
1 answer

Disable cache digests in Rails 4

I'm in the process of migrating a Rails 3 app to Rails 4. The migration was mostly fairly smooth, but one big problem I'm encountering is that my old Rails 3 code to expire my caches isn't working. I'm getting logs like: Expire fragment…
AlexC
  • 3,610
  • 3
  • 26
  • 26
2
votes
0 answers

Russian Doll Cache Digest Partials Not Bubbling Up

From my understanding of Russian Doll caching with Cache Digests, in order to prevent us from having to version the fragments, if I update a child fragment the digest key should bubble up to expire it's parent. If this is correct I am having an…
1
vote
1 answer

Nesting cached Rails fragments slows down site by 300% in development: why?

I am developing a Rails (4.1.14) site that uses Russian doll caching as follows: home.html.erb: <%= render partial: 'product/group', locals: {products: @products} %>` product/_group.html.erb: <% products.each do |product| %> <%= render partial:…
isthmuses
  • 1,316
  • 1
  • 17
  • 27
1
vote
1 answer

What formats does ActionView::Digestor.new accept for name?

I'm poking around in the console to figure out how cache digest dependencies are calculated. This works for the app/views/posts/show.html.haml template: ActionView::Digestor.new(name: "posts/show", finder: finder).digest # => Cache digest for…
John Bachir
  • 22,495
  • 29
  • 154
  • 227
1
vote
0 answers

Disable cache digest in rails4

Im upgrading from rails 3.2.13 to rails 4.0.1. I'm facing problem with caching which giving me undefined method 'expired_fragment'. Is there a way to disable cache digest? I added these gems as well: gem 'actionpack-page_caching', github:…
Nich
  • 1,112
  • 1
  • 14
  • 29
0
votes
1 answer

Whats the template option in cache_digests gem for?

I am using the cache_digests gem. I am trying to understand whats the purpose of TEMPLATE option in rake cache_digests:nested_dependencies and cache_digests:dependencies rake tasks. Could you also tell what the output means? Does the output shows…
felix
  • 11,304
  • 13
  • 69
  • 95
0
votes
1 answer

Rails cache_digests and AbstractControllers

I have a class that I use to render some pdfs inheriting from AbstractController and I'd like to use cache_digests in the views class PDFExporter < AbstractController::Base include AbstractController::Rendering include ActionView::Layouts …
Adriano Bacha
  • 1,114
  • 2
  • 13
  • 22