Skip to content

Add caching for data fetched from MongoDB #166

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

Merged
merged 10 commits into from
May 30, 2025
Merged

Conversation

EbiArnie
Copy link
Contributor

This adds caching for data from MongoDB. To do this efficiently, we do not immediately decode the BSON we receive from MongoDB, since we may want to have the binary data to store it in Redis. We still need to serialize this data, since we are dealing with a list of BSON objects. To do this, we use pickle.
We re-use the existing Redis connection that we already have.

If this code is run with different Python versions, they must use the same pickle versions. Otherwise, they may not share the same cache.

This adds caching for data from MongoDB. To do this efficiently, we do
not immediately decode the BSON we receive from MongoDB, since we may
want to have the binary data to store it in Redis.
We still need to serialize this data, since we are dealing with a
list of BSON objects. To do this, we use pickle.
We re-use the existing Redis connection that we already have.

If this code is run with different Python versions, they must use the
same pickle versions. Otherwise, they may not share the same cache.
@EbiArnie EbiArnie requested review from bilalebi and kamaldodiya May 28, 2025 15:02
@EbiArnie EbiArnie merged commit 090fdcd into develop May 30, 2025
1 check passed
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