Re: Async Caching

2020-09-28 Thread Adam Johnson
> > I think right now I would prefer get_async all things considered Ditto - reading is more important than writing, and starting with the operation means earlier comprehension of the operation. Also typing-aware autocomplete can notice when you type "await' and prefer autocompleting async metho

Re: Async Caching

2020-09-27 Thread Andrew Godwin
So the debate between async_foo and foo_async has not really happened yet; I'm really split on the choice. As you say, async_foo allows you to get to the async versions quicker, but foo_async allows you to start your typing with the operation you're doing and then select the variant. I think ri

Re: Async Caching

2020-09-27 Thread Andrew Wang
Cool, thanks for the clarification. One thing I noticed while programming the test cases (so WIP is here: https://github.com/Andrew-Chen-Wang/django-async-redis) is that it's not really fun having to type out get_async since autocomplete. If a dev knows that they'll be using an await, then I th

Re: Async Caching

2020-09-27 Thread Adam Johnson
> > I'm slightly confused by what you mean (and what the dep means). I understand the DEP as saying that we'll implement the async methods in the BaseCache class as backing onto the sync versions: class BaseCache async def get_async(...): return await asgiref.sync_to_async(self.get)(

Re: Async Caching

2020-09-26 Thread Andrew Wang
Hey Adam and Andrew, I can definitely make the naming scheme something like get_async() rather than just get(). > This section specifically says that the default implementations will back onto the sync methods by default, so built-in cache backends won't need to all be converted (at once?). I

Re: Async Caching

2020-09-26 Thread Andrew Godwin
Agreed - there's no work on caching inside Django yet, since the ORM is my next focus, but I would definitely suggest writing a new pluggable third-party backend that somehow provides async versions of the methods. The main work to do here is to work how quite how possible it is to offer all of

Re: Async Caching

2020-09-26 Thread Adam Johnson
Hi Andrew I don't believe any work has started on async caching in core. However there is a plan in DEP 9, the document that outlines how asynchronous caching will work, using suffixed methods like get_async() etc. See https://github.com/django/deps/blob/master/accepted/0009-async.rst#caching . Th