From ab2af4dfcb61b568a9753b97dc55f1b45e3a824e Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 14 Jul 2016 18:38:16 +0800 Subject: Modify LogSubscriber for single partial's cache message. 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 --- actionview/CHANGELOG.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'actionview/CHANGELOG.md') diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md index 7754bd8dd9..bd6f2d788d 100644 --- a/actionview/CHANGELOG.md +++ b/actionview/CHANGELOG.md @@ -9,6 +9,30 @@ *Steven Harman* +* Show cache hits and misses when rendering partials. + + Partials using the `cache` helper will show whether a render hit or missed + the cache: + + ``` + Rendered messages/_message.html.erb in 1.2 ms [cache hit] + Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss] + ``` + + This removes the need for the old fragment cache logging: + + ``` + Read fragment views/v1/2914079/v1/2914079/recordings/70182313-20160225015037000000/d0bdf2974e1ef6d31685c3b392ad0b74 (0.6ms) + Rendered messages/_message.html.erb in 1.2 ms [cache hit] + Write fragment views/v1/2914079/v1/2914079/recordings/70182313-20160225015037000000/3b4e249ac9d168c617e32e84b99218b5 (1.1ms) + Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss] + ``` + + Though that full output can be reenabled with + `config.action_controller.enable_fragment_cache_logging = true`. + + *Stan Lo* + * New syntax for tag helpers. Avoid positional parameters and support HTML5 by default. Example usage of tag helpers before: -- cgit v1.2.3