#33573: Add native async support to redis cache backend
-------------------------------------+-------------------------------------
     Reporter:  Christopher Bailey   |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Core (Cache system)  |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Someday/Maybe
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Old description:

> Do you have an idea for implementation? As far as I'm aware this would
> require initializing two redis clients: async and non-async.
>
> I kind of started to implement it, but then realized it was likely going
> to be a bigger issue then I though. But there is already an abstract
> RedisClient class that is a wrapper around the base redis.Redis class. It
> maintains connection polls and handles all of the core commands. It has
> methods for `get`, `set`, `add`, `touch`, `incr` that just calls
> `get_client` and makes a new client using the existing connection pull
> any time it is called.
>
> For Async we can just add something like `get_async_client` and follow
> the same pattern within the class. I believe the connection poll should
> be able to be reused between the sync/async clients.

New description:

 The latest version of redis-py will support both sync and async clients so
 `sync_to_async` will no longer be necessary so it would be nice if the out
 of the box Redis cache backend supports both natively as well.

 https://github.com/redis/redis-py/releases/tag/v4.2.0rc1

 It may be a bit premature since 4.2.0 is still RC, but I wanted to get a
 ticket out there so it can be on someones radar.

--

Comment (by Christopher Bailey):

 Do you have an idea for implementation? As far as I'm aware this would
 require initializing two redis clients: async and non-async.

 I kind of started to implement it, but then realized it was likely going
 to be a bigger issue then I though. But there is already an abstract
 RedisClient class that is a wrapper around the base redis.Redis class. It
 maintains connection polls and handles all of the core commands. It has
 methods for `get`, `set`, `add`, `touch`, `incr` that just calls
 `get_client` and makes a new client using the existing connection pull any
 time it is called.

 For Async we can just add something like `get_async_client` and follow the
 same pattern within the class. I believe the connection poll should be
 able to be reused between the sync/async clients.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33573#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107017f88d0f83c-44feaa6a-fd9e-4b69-b860-95eb8f5d857e-000000%40eu-central-1.amazonses.com.

Reply via email to