Implementation:LMCache LMCache Basic Check
| Knowledge Sources | |
|---|---|
| Domains | Testing, CLI |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
Provides a command-line diagnostic tool for running basic checks against LMCache components such as remote storage and the storage manager.
Description
This module implements an async CLI application for LMCache health checks and diagnostics. It uses an argument parser to accept a --mode flag that selects the check to run (e.g., test_remote, test_storage_manager), along with optional parameters for model name, number of keys, concurrency level, and key offset. The mode functions are loaded dynamically from a registry (lmcache.v1.check.registry). When --mode list is specified, it enumerates all available check modes. The main function runs asynchronously via asyncio.run to support async check implementations.
Usage
Run this module as python -m lmcache.v1.basic_check --mode <mode_name> to execute a diagnostic check. Use --mode list to discover available check modes. Additional flags like --num-keys, --concurrency, and --offset configure key generation for stress testing.
Code Reference
Source Location
- Repository: LMCache
- File: lmcache/v1/basic_check.py
- Lines: 1-75
Signature
def parse_args() -> argparse.Namespace: ...
async def main() -> None: ...
Import
from lmcache.v1.basic_check import parse_args, main
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| --mode | str | Yes | Check mode to execute, or "list" to show available modes |
| --model | str | No (default "/lmcache_test_model/") | Model name for the check |
| --num-keys | int | No (default 100) | Number of keys to generate during the check |
| --concurrency | int | No (default 16) | Concurrency level for parallel key operations |
| --offset | int | No (default 0) | Starting offset for key generation |
Outputs
| Name | Type | Description |
|---|---|---|
| (stdout) | text | Check results, available modes listing, or error messages printed to console |
Usage Examples
# List available check modes
# python -m lmcache.v1.basic_check --mode list
# Run a remote storage check with 50 keys at concurrency 8
# python -m lmcache.v1.basic_check --mode test_remote --num-keys 50 --concurrency 8
# Programmatic usage
import asyncio
from lmcache.v1.basic_check import main
asyncio.run(main())