title: Django caching in authenticated sites: best practices
body: <p>I need to add memcached to my django website.
  It's an authenticated website, where different users see different data on the same pages.
  Which are the best practices?
  I mean, to avoid users to see each other cached pages (information leak)...</p>
  
  <p>I suppose i should use something like:</p>
  
  <pre><code>{% load cache %}
  {% cache 500 sidebar request.user.username %}
      .. sidebar for logged in user ..
  {% endcache %}
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>@vary_on_cookie
  def my_view(request):
      # ..
  </code></pre>
  
  <p>Which is the safest and better way?</p>