Opened 2 months ago
Last modified 2 months ago
#35743 closed New feature
Add a method to cached_property for clearing its cached value — at Version 2
Reported by: | Jae Hyuck Sa | Owned by: | Jae Hyuck Sa |
---|---|---|---|
Component: | Utilities | Version: | 5.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I would like to propose an enhancement to Django's cached_property. Currently, cached_property does not provide a built-in way to clear its cached value from an instance. To reset the cached value, developers must manually delete the property from the instance's dict.
This proposal was inspired by a suggestion made by Jacob Tyler Walls on this pull request(https://github.com/django/django/pull/18534#:~:text=5%20days%20ago-,jacobtylerwalls%20reviewed%204%20days%20ago,-View%20reviewed%20changes), where it was recommended to expose this functionality on cached_property rather than implementing it individually for each property.
By incorporating this functionality, developers can avoid implementing custom methods for each property, which will promote cleaner and more maintainable code.
Feedback and suggestions from the community are greatly appreciated!
Change History (2)
comment:1 by , 2 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:2 by , 2 months ago
Description: | modified (diff) |
---|