-
Notifications
You must be signed in to change notification settings - Fork 113
Migrate IPyPiClient cache to LRU MemoryCache #80
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
Conversation
… into cobya/PyPyCache
|
👋 Hi! It looks like you modified some files in the
If none of the above scenarios apply, feel free to ignore this comment 🙂 |
| private const long CACHEINTERVALSECONDS = 60; | ||
| private const long DEFAULTCACHEENTRIES = 128; |
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.
Were this just an estimate?
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.
Yes, they are currently an estimate, but introduced a new telemetry class to track cache usage statistics so we can adjust in the future.
|
@cobya Sorry! I accidentally had the wrong issue number in my PR. |
… into cobya/PyPyCache
Updates the caching mechanism in IPyPiClient from using a ConcurrentDictionary to a Microsoft.Extensions.Caching.Memory MemoryCache which allows setting a maximum number of cache entries and a cache entry expiration time. By limiting the number of entries the memory usage will be lowered and because of expiration time if the tool has not finished by the time the cache is no longer being used memory will be freed before exiting the program.
For users that need additional configuration (potentially due to memory constraints), allow them to set a maximum number of cache entries using the PyPiMaxCacheEntries environment variable.
This resolves the issue #35