[MP] Support lazy import built-in l2 adapter#2905
Merged
maobaolong merged 4 commits intoLMCache:devfrom Apr 14, 2026
Merged
Conversation
Signed-off-by: baoloongmao <baoloongmao@tencent.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request transitions the L2 adapter discovery from an eager import model to a lazy loading approach. It adds a pending module registry and functions to defer module imports until an adapter is explicitly requested or the full registry is accessed. The review feedback highlights a violation of the project's style guide, as the new lazy loading feature was submitted without accompanying unit tests to verify its behavior and error handling.
Signed-off-by: baoloongmao <baoloongmao@tencent.com>
Collaborator
Author
|
@sammshen @chunxiaozheng Would you like to take a look at this PR? Thanks! |
Contributor
|
will take a look tmrw! |
ekaynar
pushed a commit
to ekaynar/LMCache
that referenced
this pull request
Apr 15, 2026
* Support lazy import built-in l2 adapter Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Update doc Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Add UTs Signed-off-by: baoloongmao <baoloongmao@tencent.com> --------- Signed-off-by: baoloongmao <baoloongmao@tencent.com>
ftian1
pushed a commit
to ftian1/LMCache
that referenced
this pull request
Apr 20, 2026
* Support lazy import built-in l2 adapter Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Update doc Signed-off-by: baoloongmao <baoloongmao@tencent.com> * Add UTs Signed-off-by: baoloongmao <baoloongmao@tencent.com> --------- Signed-off-by: baoloongmao <baoloongmao@tencent.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Transitions the L2 adapter discovery from an eager import model to a lazy loading approach.
Special notes for your reviewers:
If applicable:
Note
Medium Risk
Changes adapter discovery/registration timing and error propagation by switching from eager imports to on-demand module loading, which could affect runtime initialization and CLI adapter listing if an adapter module has import-time side effects or missing deps.
Overview
Switches built-in L2 adapter discovery from eager package-wide imports to lazy, on-demand module loading:
l2_adapters/__init__.pynow records*_l2_adaptermodules as pending, andfactory.pyimports them only when a specific adapter type is requested.Updates config parsing and type listing to work with lazy loading (
_ensure_config_loadedduring--l2-adapterparsing;get_registered_l2_adapter_types()now forces loading all pending modules for complete CLI choices), and adds unit tests covering the new pending-module/ensure-load behavior plus docs describing the new self-registration workflow.Reviewed by Cursor Bugbot for commit 2ff265a. Bugbot is set up for automated code reviews on this repo. Configure here.