-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fragment Cache #802
Comments
I just want to say that if this is done active_model_serializers will be shipped by default in new Rails 5.0 apps. |
@guilleiguaran haha 👍 it will be done! |
Go go go, @joaomdmoura 😁 |
👍 |
I'm not sure if I should also enable users to cache relationships (all their attributes). @kurko any thoughts? |
@kurko, never mind haha I ended up doing it. Example. LikeSerializer = Class.new(ActiveModel::Serializer) do
cache only: [:post]
attributes :id, :time
belongs_to :post
end The response generated by the I'll finish some details, squash, document it and open the PR. |
Excellent work! @joaomdmoura On Wednesday, 11 February 2015, João Moura [email protected] wrote:
Sent from Gmail Mobile |
Promising! |
Hey, how are things going with this? do you need any help? |
Hey @joaomdmoura this is awesome to hear. Looking forward to seeing the updates! |
thanks so much for your work @joaomdmoura 🍻 |
it was already merged. I'm closing it ❤️ |
Considering my PR #693
Cache Composition (http://robots.thoughtbot.com/fast-json-apis-in-rails-with-key-based-caches-and) is one of the work-arounds for the absence of fragmente cache on AMS.
As we know, a fragment cache implementation would be extremely efficient to improve API's that have some dynamic attributes that may vary on every request.
Assuming that PR #693 will be merged soon, this should be a new feature to the cache implementation, my proposal is to follow Rails conventions, adding two new options to
cache
method:only
andexcept
.Example:
In the example, only the
title
attribute would be cached, everything else would be retrieved from thePost
object.Except
would work exactly the opposite.Despite of being a simple new feature it isn't quite easy and small. So I'm not moving forward with this on PR #693
I'll try to work on this asap, but would like to hear some thoughts about it.
cc/ @kurko @steveklabnik @nwjsmith
The text was updated successfully, but these errors were encountered: