-
Notifications
You must be signed in to change notification settings - Fork 34
Refactor: Consolidate caching patterns into shared LocatorCache abstraction #301
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
base: main
Are you sure you want to change the base?
Conversation
…ux-global-python Co-authored-by: karthiknadig <3840081+karthiknadig@users.noreply.github.com>
PR Review: Refactor Caching Patterns into Shared LocatorCache Abstractioncc @copilot Overall: Generally good, with a few concerns worth discussing✅ What I Like
|
…st_use] to get_or_insert_with Co-authored-by: karthiknadig <3840081+karthiknadig@users.noreply.github.com>
Addressed in c8f43b0:
Re: other observations:
|
|
Thanks @copilot - the fixes look good!
The explanations for |
LocatorCache<K, V>generic caching abstraction inpet-coreget(),get_or_insert_with(),insert(),contains_key(),clear(),values(),len(),is_empty(), andclone_map()methodsEnvironmentCacheandManagerCachefor common usespet-condato use the new cache abstractionpet-linux-global-pythonto use the new cache abstractioninsert_many()method for atomic batch inserts (addresses lock granularity concern)#[must_use]attribute toget_or_insert_with()pet-linux-global-pythonto useinsert_many()for symlinks + executableSummary
This PR introduces a generic
LocatorCache<K, V>abstraction in thepet-corecrate that consolidates the common caching patterns used across multiple locators. The cache provides:RwLockget_or_insert_with()to prevent redundant computationinsert_many()for better lock efficiencyEnvironmentCache,ManagerCache)Security Summary
No security vulnerabilities were discovered by CodeQL analysis.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.