__init__.py 544 B

1234567891011121314151617181920
  1. VERSION = (5, 4, 0)
  2. __version__ = ".".join(map(str, VERSION))
  3. def get_redis_connection(alias="default", write=True):
  4. """
  5. Helper used for obtaining a raw redis client.
  6. """
  7. from django.core.cache import caches
  8. cache = caches[alias]
  9. if not hasattr(cache, "client"):
  10. raise NotImplementedError("This backend does not support this feature")
  11. if not hasattr(cache.client, "get_client"):
  12. raise NotImplementedError("This backend does not support this feature")
  13. return cache.client.get_client(write)