Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:LMCache LMCache SGLang Utils

From Leeroopedia
Revision as of 15:25, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/LMCache_LMCache_SGLang_Utils.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Integration, Configuration
Last Updated 2026-02-09 00:00 GMT

Overview

Utility functions for the SGLang integration layer, providing configuration loading and boolean string parsing.

Description

This module contains helper functions used by LMCache's SGLang integration. The is_false function checks whether a string value represents a falsy boolean (supporting "false", "0", "no", "n", "off"). The lmcache_get_config function reads the LMCache engine configuration either from a YAML file specified by the LMCACHE_CONFIG_FILE environment variable or falls back to reading individual configuration values from environment variables via LMCacheEngineConfig.from_env().

Usage

Use lmcache_get_config at SGLang startup to obtain the LMCache engine configuration. Use is_false when interpreting environment variable strings as boolean flags in the integration layer.

Code Reference

Source Location

Signature

def is_false(value: str) -> bool: ...

def lmcache_get_config() -> LMCacheEngineConfig: ...

Import

from lmcache.integration.sglang.utils import is_false, lmcache_get_config

I/O Contract

Inputs

Name Type Required Description
value str Yes (is_false) String value to check for falsy meaning
LMCACHE_CONFIG_FILE env var No Environment variable pointing to a YAML configuration file path

Outputs

Name Type Description
bool bool True if the string is a falsy value (is_false)
config LMCacheEngineConfig Loaded engine configuration object (lmcache_get_config)

Usage Examples

from lmcache.integration.sglang.utils import is_false, lmcache_get_config

# Check a boolean environment variable
if not is_false(os.getenv("LMCACHE_ENABLED", "true")):
    config = lmcache_get_config()
    # ... initialize LMCache with SGLang ...

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment