Skip to content

Switch property to cached_property#73

Open
vsalvino wants to merge 2 commits intomainfrom
cached
Open

Switch property to cached_property#73
vsalvino wants to merge 2 commits intomainfrom
cached

Conversation

@vsalvino
Copy link
Contributor

Fixes #69

Should lead to a slight performance improvement.

@vsalvino vsalvino added this to the 3.0 milestone Sep 27, 2024
@vsalvino vsalvino removed this from the 3.0 milestone Feb 6, 2025
@Prill
Copy link

Prill commented Nov 13, 2025

@vsalvino Came here from #69. Poking around at the failing test_struct_org test, one thing I noticed is that you are applying @cached_property to methods that return mutable objects (seo_struct_org_base_dict and seo_struct_org_dict). But seo_struct_org_dict calls update on the value that is returned from seo_struct_org_base_dict, meaning that it's updating the cached value that the base property returns. I'm not sure if that's what's causing the specific error since the output doesn't show the actual response contents, but that seems incorrect regardless.

I'm not sure what the best solution overall is, but theoretically you could apply the @cached_property decorate only on properties that return immutable values, like seo_struct_org_base_json and seo_struct_org_json.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache property

2 participants