Caching with memcached

I have a section in my main layout as shown below. I'm starting to use memcached and wondering if this part can be cached in some way due to the fact that the current_user call causes the database to get into each page load and by the nature of the plugin (authlogic) that is behind it, it actually updates the user record (i.e. perishable token).

Is there anyway around this via caching or any other means?

<ul class="header_links">
                <% unless  current_user %>
                  <li><%= link_to "Sign Up", new_user_path, :id => 'main_sign_up_link', :class=> 'special-text'%></li>
                  <li><%= link_to "Login", login_path, :id => 'main_login_link' %></li>
                <% else %>
                  <li><%= link_to "New Vote", new_user_vote_topic_path(current_user), :id => 'main_new_vote_link',  :class=> 'special-text' %></li>
                  <li><%= link_to current_user.username.titleize, current_user, :id => 'main_profile_link' %></li>
                  <li><%= link_to "Logout", logout_path  %></li>
                <% end %>
              </ul>
+3
source share
1 answer

? fooobar.com/questions/1046492/... , , disable_perishable_token_maintenance = true, update-db .

- . , , , user_id.

+1

Source: https://habr.com/ru/post/1757487/


All Articles