aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/cache_helper.rb
Commit message (Collapse)AuthorAgeFilesLines
* Move digest path calculation out of loopschneems2018-09-111-9/+17
| | | | | | | | | | | On every iteration of generating a cache for a collection a “digest path” is calculated even though it’s exactly the same for every element. This PR exposes a method `digest_path_from_virtual` that returns back a “digest_path”. This can in turn be passed back into `cache_fragment_name`. This not only does less work, but it also (you guessed it) uses less memory. before: Total allocated: 762539 bytes (7035 objects) after: Total allocated: 743590 bytes (6621 objects) (762539 - 743590)/ 762539.0 # => 2.4% faster ⚡️⚡️
* Fix RDoc formatting: `+` doesn't work with space [ci skip]yuuji.yaginuma2018-05-231-1/+1
| | | | Follow up of #32958.
* Indicate `true` in a doc comment is code-like.Corey Farwell2018-05-221-1/+1
|
* Use tt in doc for ActionView [ci skip]Yoshiyuki Hirano2017-08-271-4/+4
|
* Fix broken doc layout for action_view [ci skip]Yoshiyuki Hirano2017-08-271-1/+1
|
* Use frozen string literal in actionview/Kir Shatrov2017-07-241-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Don't rely on the @view_renderer being defined.Kasper Timm Hansen2017-06-081-2/+2
| | | | That won't be true for Action Pack and Action Mailer.
* Merge pull request https://github.com/rails/rails/pull/28637 from ↵Kasper Timm Hansen2017-06-081-6/+2
| | | | st0012/fix-partial-cache-logging
* Use a hash to record every partial's cache hit status instead of sharing a ↵Stan Lo2017-06-081-2/+4
| | | | boolean.
* Use recyclable cache keys (#29092)David Heinemeier Hansson2017-05-181-9/+17
|
* Remove unnecessary comments in cache_helper.rb [ci skip]kenta-s2017-01-211-2/+0
|
* No need to nodoc private methodsAkira Matsuda2016-12-241-4/+4
|
* Fix spelling in API docsDave Powers2016-11-121-1/+1
| | | | [ci skip]
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* Simplify cache hit loggingAaron Patterson2016-08-241-3/+4
| | | | | | | CacheHelper is mixed in to Helpers, Helpers is mixed in to AV::Base. This means we can count on instances of AV::Base to have the "cache hit" method on them, and we can stop setting an ivar for cache logging and just ask the view if it was a cache hit.
* Modify LogSubscriber for single partial's cache message.Stan Lo2016-08-081-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement naive partial caching mechanism. Add test for LogSubscriber Use ActionView::Base#log_payload to store log_subscriber's payload, so we can pass cache result into it. Fixed tests Remove useless settings Check if #log_payload exists before calling it. Because other classes also includes CacheHelper but don't have is attribute Use @log_payload_for_partial_reder instead of #log_payload to carry ActionView's payload. Update test's hash syntax Add configuration to enable/disable fragment caching logging Remove unless test and add new test to ensure cache info won't effect next rendering's log Move :enable_fragment_cache_logging config from ActionView to ActionPack Apply new config to tests Update actionview's changelog Update configuration guide Improve actionview's changelog Refactor PartialRenderer#render and log tests Mute subscriber's log instead of disabling instrumentation. Fix typo, remove useless comment and use new hash syntax Improve actionpack's log_subscriber test Fix rebase mistake Apply new config to all caching intstrument actions
* Explain meaning of the code very well and Remove confusion. [ci skip]Santosh Wadghule2016-07-231-4/+4
| | | | | | Code like `render(topics) => render("topics/topic")` adds confusion for the readers. On first impression, that code feels like hash kind of data, but it's not. So make it more clear and meaningful.
* Bring back support for callable cache_key on collection renderingIgnatius Reza2016-07-211-3/+12
|
* `md5` --> `MD5`Jon Moss2016-05-171-3/+3
| | | | | Sorry, I missed a few places in my last PR. This should be the last of 'em :grimacing:
* [ci skip] Document collection caching better.Kasper Timm Hansen2016-02-211-2/+15
| | | | | | | | Why are we here? Where did we come from? Where are we going... in 5 minutes? These questions are not answered in this documentation. Instead collection caching is better clarified. How it works, how it can share caches with individual templates.
* Make collection caching explicit.Kasper Timm Hansen2016-02-201-35/+7
| | | | | | | | | | | | Having collection caching that wraps templates and automatically tries to infer if they are cachable proved to be too much of a hassle. We'd rather have it be something you explicitly turn on. This removes much of the code and docs to explain the previous automatic behavior. This change also removes scoped cache keys and passing cache_options.
* Slice out options for cache_fragment_name explicitlyRyan Bigg2016-01-281-1/+2
| | | | This allows expire_in (and other options) to be passed to the cache method
* Remove ActionView::Helpers::CacheHelper#fragment_cache_keySam Stephenson2015-12-141-8/+0
| | | | | | Introduced in e56c63542780fe2fb804636a875f95cae08ab3f4, `CacheHelper#fragment_cache_key` is a duplicate of `ActionController::Caching::Fragments#fragment_cache_key`. We now require the view to provide this method on its own (as with `view_cache_dependencies`); `ActionController::Caching::Fragments` exports its version as a `helper_method`.
* Fix calling cache helper with a relationLachlan Sylvester2015-08-281-3/+2
|
* Add wildcard template dependencies.Kasper Timm Hansen2015-07-261-1/+13
|
* Support explicit defintion of resouce name for collection caching.Dov Murik2015-07-071-0/+15
| | | | | | | | | | | | | | If a template includes `# Template Collection: ...` anywhere in its source, that name will be used as the cache name for the partial that is rendered for the collection. This allows users to enable collection caching even if the template doesn't start with `<% cache ... do %>`. Moreover, the `# Template Collection: ...` notation is recognized in all template types (and template types other than ERB can define a resource_cache_call_pattern method to allow the `cache ... do` pattern to be recognized too).
* Fix cache issue when different partials use the same collectionRoque Pinel2015-06-281-11/+13
| | | | | | | | | Adds the `virtual_path` option to `cache_fragment_name` so it can be provided when needed. That allows `cache_collection_render` to get the appropriate cache key with the digest generated based on the template and prevent collision with other templates that cache the same collection.
* Tiny documentation edits [ci skip]Robin Dupret2015-06-091-7/+7
|
* Better formatted documents [ci skip]Gourav Tiwari2015-05-081-8/+12
|
* Make ActionMailer #cache helper a no-op, not an exceptionJavan Makhmali2015-04-281-1/+1
|
* Merge pull request #18948 from kaspth/automatic-collection-cachingRafael Mendonça França2015-02-251-0/+31
|\ | | | | Merge multi_fetch_fragments.
| * Collections automatically cache and fetch partials.Kasper Timm Hansen2015-02-211-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Collections can take advantage of `multi_read` if they render one template and their partials begin with a cache call. The cache call must correspond to either what the collections elements are rendered as, or match the inferred name of the partial. So with a notifications/_notification.html.erb template like: ```ruby <% cache notification %> <%# ... %> <% end %> ``` A collection would be able to use `multi_read` if rendered like: ```ruby <%= render @notifications %> <%= render partial: 'notifications/notification', collection: @notifications, as: :notification %> ```
| * Merge multi_fetch_fragments.Kasper Timm Hansen2015-02-201-0/+8
| | | | | | | | | | | | | | | | Makes caching a collection of template partials faster using `read_multi` on the Rails cache store. Some caching implementations have optimized `read_multi` so we don't have to check in the cache store for every template.
* | Fix cache_helper comment ERBAnthony Dmitriyev2015-02-201-2/+2
|/
* Change links to 37signals and svn blog to point to new destinations. [ci skip]Vipul A M2014-04-121-1/+1
|
* Digestor should just rely on the finder to know about the format and the ↵David Heinemeier Hansson2014-03-211-13/+3
| | | | variant -- trying to pass it back in makes a mess of things (oh, and doesnt work)
* Ensure LookupContext in Digestor selects correct variantPiotr Chmolowski2014-03-091-4/+14
| | | | | | | | | | Related to: #14242 #14243 14293 Variants passed to LookupContext#find() seem to be ignored, so I've used the setter instead: `finder.variants = [ variant ]`. I've also added some more test cases for variants. Hopefully this time passing tests will mean it actually works.
* Variants in ActionView::DigestorPiotr Chmolowski2014-03-041-1/+1
| | | | | | | | | | | Take variants into account when calculating template digests in ActionView::Digest. Digestor#digest now takes a hash as an argument to support variants and allow more flexibility in the future. Old-style arguments have been deprecated. Fixes #14242
* fix the typo [ci skip]Rajarshi Das2013-09-021-1/+1
| | | fix the typo newstopics => new topics in action view cache helper
* Refactor cache fragment handling with read/write methodsCarlos Antonio da Silva2013-06-251-6/+6
|
* Move the write portion of fragment_for to its own method to allow for easier ↵Andrew Rove2013-06-251-10/+14
| | | | creation of custom cache methods.
* Move actionpack/lib/action_view* into actionview/libPiotr Sarnacki2013-06-201-0/+196