Last active
February 7, 2020 03:50
-
-
Save coolsoftwaretyler/1bdc269baadf6563a2df28d03cd0974b to your computer and use it in GitHub Desktop.
Revisions
-
coolsoftwaretyler revised this gist
Feb 7, 2020 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ class SampleObject < ApplicationRecord def external_components Rails.cache.fetch("#{cache_key_with_version}/components", expires_in: 12.hours) do # Some long running task that fetches "components" end end end -
coolsoftwaretyler revised this gist
Feb 6, 2020 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ <% @sample_object.external_components.each do |component| %> <% cache component do %> <%= render component %> -
coolsoftwaretyler created this gist
Feb 6, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ class SampleObject < ApplicationRecord Rails.cache.fetch("#{cache_key_with_version}/components", expires_in: 12.hours) do def external_components # Some long running task that fetches "components" end end end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ # https://guides.rubyonrails.org/caching_with_rails.html#shared-partial-caching <% @sample_object.external_components.each do |component| %> <% cache component do %> <%= render component %> <% end %> <% end %>