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 full search results. #4382

Merged
merged 2 commits into from
Sep 24, 2024
Merged

Cache full search results. #4382

merged 2 commits into from
Sep 24, 2024

Conversation

jrobbins
Copy link
Collaborator

As we chatted about, this adds redis caching of full search results.

In this PR:

  • Add a new function process_query_using_cache() that wraps around around process_query(), and some helper functions to decide which queries are cacheable.
  • Add cache invalidation calls at points where features (and their parts) are created or updated.
  • Clarified that rediscache.delete_keys_with_prefix() should take a prefix string rather than a pattern. This better fits the name of the function and the way that that it was being used.

@jrobbins jrobbins force-pushed the 20240920-cache-full-search-result branch from c4dee7c to 677047c Compare September 23, 2024 15:53
internals/search.py Outdated Show resolved Hide resolved
internals/search.py Outdated Show resolved Hide resolved
internals/search.py Outdated Show resolved Hide resolved
'show_enterprise=' + str(show_enterprise),
'start=' + str(start),
'num=' + str(num),
'name_only=' + str(name_only),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note: we only cache name_only queries for now. This part of the key is optional

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it is best to include it, just in case we decide to broaden what we cache.

@jrobbins jrobbins merged commit 5d7522c into main Sep 24, 2024
7 checks passed
@jrobbins jrobbins deleted the 20240920-cache-full-search-result branch September 24, 2024 18:02
DanielRyanSmith pushed a commit that referenced this pull request Sep 26, 2024
* Cache full search results.

* Addressed review comments.
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.

2 participants