Hi, I wonder what do you think. Is it worth caching it?
There are no calculation, no calls. The object is already loaded. Do you think it is worth caching this string or it should be generated every time.
<% cache(cache_key) do %>
<%= content_tag :article, id: dom_id(object), class: "" do %>
<% image_url = object.picture.url(size) %>
<% title = object.title %>
<% description = object.description %>
<a class="..." href="<%= url %>">
<figure class="...">
<img class="..." src="<%= image_url %>" alt="Image for <%= title %>">
</figure>
<div class="...">
<h3 class="...">
<span class=".."><%= title %></span>
</h3>
<p><%= description %></p>
</div>
</a>
<% end %>
<% end %>
Update: It is not. Cache is about 9 times slower than just concatenating this string. - Is it worth caching it?