title: Django caching with Redis
body: <p>I have implemented django caching using redis following this blog: <a href="https://realpython.com/caching-in-django-with-redis/" rel="nofollow noreferrer">https://realpython.com/caching-in-django-with-redis/</a></p>
  
  <p>So I followed this, installed the package,
  Added in</p>
  
  <pre><code>CACHES = {
  "default": {
      "BACKEND": "redis_cache.RedisCache",
      "LOCATION": "redis://127.0.0.1:8000/",
      "OPTIONS": {
          "CLIENT_CLASS": "django_redis.client.DefaultClient"
      },
      "KEY_PREFIX": "example"
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Then in views.</p>
  
  <pre><code>from django.conf import settings
  from django.core.cache.backends.base import DEFAULT_TIMEOUT
  from django.views.decorators.cache import cache_page
  
  CACHE_TTL = getattr(settings, 'CACHE_TTL', DEFAULT_TIMEOUT)
  </code></pre>
  
  <p>and then added the decorator for the function</p>
  
  <pre><code>@cache_page(CACHE_TTL)
  @login_required_dietitian
  def patient_profile(request, id):
      data = {}
      return render(request, 'profile.html', {'data':data})
  </code></pre>
  
  <p>And then I am getting this error while I run the server</p>
  
  <blockquote>
    <p>redis.exceptions.ConnectionError: Connection closed by server.</p>
  </blockquote>
  
  <p>I am new to such caching technique, Any suggestion how to resolve this issue?</p>