Re: Add decorator django.utils.functional.cached_classproperty

2020-12-30 Thread Adam Johnson
There's no need for such a decorator - a class-level cached property can already be achieved with @classproperty and @lru_cache: In [1]: from functools import lru_cache In [2]: from django.utils.functional import classproperty In [3]: class Thing: ...: @classproperty ...: @lru_cach

Re: Add decorator django.utils.functional.cached_classproperty

2020-12-30 Thread Tom Forbes
I’m slightly skeptical - a cached class property seems slightly iffy and could be achieved with just a @functools.cache’d classmethod instead? Is there a specific use case where a cached, class _property_ would be the best way? And perhaps we need to care about concurrent access here, more than

Add decorator django.utils.functional.cached_classproperty

2020-12-30 Thread Boris Krause
Hello, I propose new feature - decorator cached_classproperty. Django has a lot of methods for caching, like cached_page and cached_property. Сaching improves response times. For me it was useful. What do you think about it? https://github.com/django/django/pull/13813 Thanks!:) -- You received t