Skip to content

Implement http_cache_forever to ActionController#18394

Merged
arthurnn merged 1 commit intorails:masterfrom
arthurnn:http_cache_forever
Feb 15, 2015
Merged

Implement http_cache_forever to ActionController#18394
arthurnn merged 1 commit intorails:masterfrom
arthurnn:http_cache_forever

Conversation

@arthurnn
Copy link
Copy Markdown
Member

@arthurnn arthurnn commented Jan 8, 2015

Add http_cache_forever to ActionController, so we can cache results
forever.
Things like static pages are a good candidate for this type of caching.

This cache only controls caching headers, so it is up to the browser to
cache those requests.

First stab at #18192

@dhh @rafaelfranca @sgrif thoughts?

@dhh
Copy link
Copy Markdown
Member

dhh commented Jan 8, 2015

Lovely! Need a CHANGELOG entry as well.

@arthurnn arthurnn force-pushed the http_cache_forever branch 2 times, most recently from 33896c8 to f8ad5c8 Compare January 10, 2015 18:42
@arthurnn
Copy link
Copy Markdown
Member Author

@dhh Changelog ✔️

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to communicate why you'd reach for this method and what it does. You have an HTTP response that never changes, so you want browsers and proxies to cache it indefinitely. On the first hit, we serve the response with long-lived cache freshness response headers. Then subsequent requests will always revalidate as fresh.

This method belongs elsewhere, too. This module is concerned with caching within the app (fragments, template dependencies, etc) not HTTP cache freshness.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arthurnn
Copy link
Copy Markdown
Member Author

@jeremy I addressed most of your concerns, just leaving the where this should be still for decision. Let me know your thoughts. thanks

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the significance of this date (curious)? Thanks.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just a date on the past. But now I wonder if the last_modifed is necessary at all. I guess we could use only the etag, as that one has the version. Not 100% sure tho, as this is the opposite what @jeremy said in the comment above.. lets wait for him on this.

@andyatkinson
Copy link
Copy Markdown
Member

@arthurnn I worked on a PR but then I realized yours was much further along. I fetched yours, ran the tests, and read through them. Looks good! 👍

@dhh
Copy link
Copy Markdown
Member

dhh commented Feb 8, 2015

@jeremy Can you give this a final look over? Seems like we're just about ready for a merge.

@arthurnn
Copy link
Copy Markdown
Member Author

arthurnn commented Feb 9, 2015

@jeremy let me know your thoughts, I can fix/rebase/merge this when you fell this is ready!

@jeremy
Copy link
Copy Markdown
Member

jeremy commented Feb 9, 2015

🚢

@kaspth
Copy link
Copy Markdown
Contributor

kaspth commented Feb 14, 2015

@arthurnn just a reminder that you're also working on this and need to rebase 😄

@arthurnn
Copy link
Copy Markdown
Member Author

merging this today, after breakfast =)

Add http_cache_forever to ActionController, so we can cache results
forever.
Things like static pages are a good candidate for this type of caching.

This cache only controls caching headers, so it is up to the browser to
cache those requests.
arthurnn added a commit that referenced this pull request Feb 15, 2015
Implement http_cache_forever to ActionController
@arthurnn arthurnn merged commit e825042 into rails:master Feb 15, 2015
@arthurnn arthurnn deleted the http_cache_forever branch February 15, 2015 17:17
@kaspth
Copy link
Copy Markdown
Contributor

kaspth commented Feb 15, 2015

forever ❤️

@arthurnn
Copy link
Copy Markdown
Member Author

🎉 😸

@dhh
Copy link
Copy Markdown
Member

dhh commented Feb 15, 2015

Boom! 🤘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants