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

Cache remote JSON schemas #155

Merged
merged 3 commits into from
Jul 8, 2024

Conversation

avbentem
Copy link
Contributor

@avbentem avbentem commented Jul 7, 2024

This caches remote JSON schemas for repeated use. Closes #142.

The value 128 in @lru_cache(maxsize=128) is actually the default, so just added to be explicit that it's not an endless cache.

@avbentem avbentem changed the title Draft: Cache remote JSON schemas Cache remote JSON schemas Jul 7, 2024
Copy link
Collaborator

@geospatial-jeff geospatial-jeff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, downside of functools.lru_cache is no TTL but extension schemas change infrequently enough I can't imagine this will be a problem. I'm imagining, for example, a long-lived fastapi service that is using stac-pydantic.

stac_pydantic/extensions.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.02%. Comparing base (a927d25) to head (03f0873).
Report is 56 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #155      +/-   ##
==========================================
- Coverage   96.59%   96.02%   -0.57%     
==========================================
  Files          25       25              
  Lines         587      579       -8     
==========================================
- Hits          567      556      -11     
- Misses         20       23       +3     
Flag Coverage Δ
unittests 96.02% <100.00%> (-0.57%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vincentsarago
Copy link
Member

thanks @avbentem 🙏

@vincentsarago vincentsarago merged commit 4272d86 into stac-utils:main Jul 8, 2024
5 checks passed
@avbentem avbentem deleted the cache-remote-schemas branch July 8, 2024 08:01
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.

Should validate_extensions cache remote JSON schemas?
4 participants