About Caching Method Values
You can cache the value of a method so that it can be called more than once, but calculated just once:
1 2 3 4 5 |
|
Another option – use @lru_cache
decorator:
1 2 3 4 5 6 |
|
Or just use the @cache
decorator since Python 3.9:
1 2 3 4 5 6 |
|
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django App for You
Django GDPR Cookie Consent app
For Django websites that use cookies.
Django App for You