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

PoC with response and API caching #372

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open

Conversation

lwesterhof
Copy link
Member

This PR adds caching for Flask responses to avoid re-rendering templates, improving performance. It introduces API caching for a limited set of endpoints with defined timeouts.

Additionally, some API calls have been moved to the client side to leverage the template cache, further enhancing efficiency. Certain API calls will trigger cache clearing to ensure users receive up-to-date information.

@lwesterhof lwesterhof force-pushed the portal-caching branch 12 times, most recently from 42111c9 to 00d8cbc Compare November 6, 2024 15:27
@lwesterhof lwesterhof force-pushed the portal-caching branch 2 times, most recently from 549043c to 175d723 Compare November 18, 2024 12:08
@FuHsinyu
Copy link
Member

Perhaps it is already in your TODOs, a note is that I encountered an error of flask_session version is outdated in the requirement.txt. Thus, importing flask_session.filesystem reported an error. Upgrading flask_session to 0.8.0 resolved the issue.

@lwesterhof
Copy link
Member Author

Yeah, I already upgraded the versions in development. Will merge with this branch soon.

@lwesterhof lwesterhof marked this pull request as ready for review January 8, 2025 10:04
@lwesterhof lwesterhof requested a review from FuHsinyu January 8, 2025 10:06
def make_key(api_key: Optional[str] = None) -> str:
"""Generate a cache key based on the request and authentication status.

:param api_key: Optional custom key indentifying API endpoint. If None, defaults to request endpoint and method
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
:param api_key: Optional custom key indentifying API endpoint. If None, defaults to request endpoint and method
:param api_key: Optional custom key identifying API endpoint. If None, defaults to request endpoint and method

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.

3 participants