-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: improved caching memory usage #221
Conversation
Reviewer's Guide by SourceryThis PR improves memory usage in caching by implementing compression for JSON values and optimizing Redis data structures. The changes include switching from individual keys to hash maps for search data storage and adding zlib compression for API cache values. Updated class diagram for CacheManagerclassDiagram
class CacheManager {
+get_api_cache(cache_key: str) dict | list | None
+update_api_cache(cache_key: str, value: dict | list, expire: int) None
+get_search_data_cache(data_type: SearchDataType, cache_key: str) str | None
+update_search_data_cache(search_data: dict) None
__compress_json_value(value: dict | list) str
__decompress_json_value(api_cache: str) dict | list
}
note for CacheManager "Improved memory usage by compressing JSON values and using hash maps for Redis storage."
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @TeKrop - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a TTL to the Redis hashes for search data to prevent unbounded growth, similar to the previous implementation's
search_data_timeout
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Improve caching memory usage by introducing JSON compression and decompression for API cache values. Optimize search data caching by switching from Redis 'set' to 'hset'. Update Dockerfile to use a different OpenResty image and install additional dependencies. Adjust test cases to reflect changes in cache handling.
New Features:
Enhancements:
Build:
Tests: