LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph-sdkcache
    Module●Since v0.3

    cache

    Key/value cache for use inside LangGraph deployments.

    Thin wrapper around langgraph_api.cache. Values must be JSON-serializable (dicts, lists, strings, numbers, booleans, None).

    Attributes

    attribute
    T
    attribute
    CacheStatus: Literal['miss', 'fresh', 'stale', 'expired']

    Functions

    function
    cache_get
    function
    cache_set
    function
    swr

    Classes

    View source on GitHub
    class
    SWRResult

    Get a value from the cache.

    Returns the deserialized value, or None if the key is missing or expired.

    Requires Agent Server runtime version 0.7.29 or later.

    Set a value in the cache.

    Load a cached value using stale-while-revalidate semantics.

    This helper is server-side only and is intended for caching internal async dependencies such as auth or metadata lookups.

    Result wrapper returned by :func:swr.