Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching the version.previous attribute #290

Open
AbdealiLoKo opened this issue Aug 24, 2022 · 0 comments · May be fixed by #292
Open

Caching the version.previous attribute #290

AbdealiLoKo opened this issue Aug 24, 2022 · 0 comments · May be fixed by #292

Comments

@AbdealiLoKo
Copy link
Contributor

Currently, the version.previous attribute is calling VersionObjectFetcher.previous
Which runs: self.previous_query(obj).first()

Because it is using .first() - a query is running every time.

It would be a nice developer experience to cache this so it does not call multiple queries.

Currently I need to do:

current = ...
previous = current.previous

And then pass it all around in my functions to avoid performance issues.
It would make my code a lot simpler if the previous property cached the value so I did not need to save it in my own separate variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants