from django.conf import settings
from django.core.validators import EmailValidator, ValidationError

import redis


def get_redis_connection():
    """
    Helper used for obtain a raw redis client.
    """
    from redis_cache.cache import pool
    connection_pool = pool.get_connection_pool(
        parser_class=redis.connection.HiredisParser,
        connection_pool_class=redis.ConnectionPool,
        connection_pool_class_kwargs={},
        **settings.REDIS)
    return redis.Redis(connection_pool=connection_pool, **settings.REDIS)


def is_email(value):
    try:
        EmailValidator()(value)
    except ValidationError:
        return False
    else:
        return True

from django.conf import settings
from django.core.validators import EmailValidator, ValidationError

import redis


def get_redis_connection():
    """
    Helper used for obtain a raw redis client.
    """
    from redis_cache.cache import pool
    client = redis.Redis(**settings.REDIS)
    client.connection_pool = pool.get_connection_pool(
        client,
        parser_class=redis.connection.HiredisParser,
        connection_pool_class=redis.ConnectionPool,
        connection_pool_class_kwargs={},
        **settings.REDIS)
    return client


def is_email(value):
    try:
        EmailValidator()(value)
    except ValidationError:
        return False
    else:
        return True

Update method of getting redis connection
Update method of getting redis connection

  from django.conf import settings
  from django.core.validators import EmailValidator, ValidationError
  
  import redis
  
  
  def get_redis_connection():
      """
      Helper used for obtain a raw redis client.
      """
      from redis_cache.cache import pool
+     client = redis.Redis(**settings.REDIS)
-     connection_pool = pool.get_connection_pool(
+     client.connection_pool = pool.get_connection_pool(
+         client,
          parser_class=redis.connection.HiredisParser,
          connection_pool_class=redis.ConnectionPool,
          connection_pool_class_kwargs={},
          **settings.REDIS)
-     return redis.Redis(connection_pool=connection_pool, **settings.REDIS)
+     return client
  
  
  def is_email(value):
      try:
          EmailValidator()(value)
      except ValidationError:
          return False
      else:
          return True
  
Update method of getting redis connection
## Code Before:
from django.conf import settings
from django.core.validators import EmailValidator, ValidationError

import redis


def get_redis_connection():
    """
    Helper used for obtain a raw redis client.
    """
    from redis_cache.cache import pool
    connection_pool = pool.get_connection_pool(
        parser_class=redis.connection.HiredisParser,
        connection_pool_class=redis.ConnectionPool,
        connection_pool_class_kwargs={},
        **settings.REDIS)
    return redis.Redis(connection_pool=connection_pool, **settings.REDIS)


def is_email(value):
    try:
        EmailValidator()(value)
    except ValidationError:
        return False
    else:
        return True

## Instruction:
Update method of getting redis connection
## Code After:
from django.conf import settings
from django.core.validators import EmailValidator, ValidationError

import redis


def get_redis_connection():
    """
    Helper used for obtain a raw redis client.
    """
    from redis_cache.cache import pool
    client = redis.Redis(**settings.REDIS)
    client.connection_pool = pool.get_connection_pool(
        client,
        parser_class=redis.connection.HiredisParser,
        connection_pool_class=redis.ConnectionPool,
        connection_pool_class_kwargs={},
        **settings.REDIS)
    return client


def is_email(value):
    try:
        EmailValidator()(value)
    except ValidationError:
        return False
    else:
        return True
