-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot get caching & deep nesting working together #408
Comments
The lower level items have to touch the update_at timestamp of the upper level items. It's a typical Rails 3.x approach to fragment caching. In Rails 4.0, "russian doll caching" is introduced and we don't have support for that here. In other words, there's no automatic cache invalidation based on templates includes without working it into your models. If you need help on the model setup, I can walk you through it. (basically it's a touch on save) |
Great to hear. Would love to see that covered in the documentation. Thanks. |
@databyte Are you stating that "Russian Doll" cache digest caching is not supported in RABL, or that cache invalidation is not inherently supported? I'm running into an issue that seems to be the same one found here: #413 Removing the "cache @campaign" line below fixes the issue, but does not allow for cache digest style caching.. campaign_groups/show.rabl:object @campaign_group attributes :id, :name child(:campaigns) do campaigns/show.rabl:object @campaign attributes :id, :name Error:TypeError - no _dump_data is defined for class Proc: |
BTW: I've traced my issue to the following inside of the Campaign model: campaign.rb
It appears that the 'send' is causing the issue. If I change it to 'read_attribute', it caches correctly. I still am unsure if RABL is caching correctly to support the russian doll style caching, but at least I've narrowed down the 'no dump_data' Proc issue |
I'm having trouble getting caching with deep nesting. The cache is only invalidated when an attribute of the top level object changes not when an attribute of any nested object changes. I can reproduce the problem locally by enabling caching (cache_all_output and cache_sources both true) with a file store cache store.
top level view
object @GAMe
cache @GAMe
attributes :id, :name, :description, :active, :reminder_count, :created_at, :updated_at
child(:releases => :releases) {
extends "release/show"
}
second level view
object @Release
cache @Release
attributes :id, :active, :game_id, :lock_release_date, :created_at, :updated_at
child(:release_date => :release_date) {
extends "release_date/show"
}
third level view
object @release_date
cache @release_date
attributes :id, :date_range_end, :date_range_start, :up_votes, :down_votes, :evidence, :release_id, :string_representation, :user_id, :submitter_type, :active, :created_at, :updated_at
Any assistance would be greatly appreciated.
The text was updated successfully, but these errors were encountered: