title: authlogic require user
body: <p>I use authlogic for authentication and certain actions require a logged in user, which is controlled via a before_filter like the following. I also use friendly_id on the User model and internally everything there is a look up on the User model there are queries to the friendly_id slug table too. This results in at least 3 queries for certain page view and this happens quite often.</p>
  
  <p>Is there a way to maintain this functionality without running these queries everytime?</p>
  
  <p>I also use memcached as an object store. Is that a possiblity? does it work well with authlogic?</p>
  
  <pre><code>def require_user
          unless current_user
              store_location
              flash[:notice] = "You must be logged in to access this page"
              redirect_to new_user_sessions_url
              return false
          end
      end
  </code></pre>