#32306: Add decorator django.utils.functional.cached_classproperty
-------------------------------------+-------------------------------------
     Reporter:  Boris                |                    Owner:  Boris
                                     |  Trubin
         Type:  New feature          |                   Status:  assigned
    Component:  Utilities            |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  cached               |             Triage Stage:  Accepted
  classproperty                      |
    Has patch:  1                    |      Needs documentation:  1
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by David Smith):

 I fear I misunderstand the issue here, if so I am sorry. Can one of the
 existing Python caches be used here?

 I've attached a small example where `lru_cache` is used stacked under the
 `classproperty` decorator.

 {{{
 class TestClass:
     @classproperty
     @lru_cache
     def test_property(self):
         time.sleep(2)
 }}}

 In my test case, I see the output as.

 {{{
 python test.py
 0:00:02.002166
 0:00:00.000037
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32306#comment:4>
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/071.1f865650e83eafac2276a4757992922c%40djangoproject.com.

Reply via email to