LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
  • RemoteGraph
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDKRemoteGraph
Language
Theme
Pythonlangsmithprompt_cacheAsyncPromptCacheaset
Method●Since v0.7

aset

Set a value in the cache.

Copy
aset(
  self,
  key: str,
  value: Any,
  refresh_func: Callable[[], Awaitable[Any]]
) -> None

Parameters

NameTypeDescription
key*str

The cache key (prompt identifier).

value*Any

The value to cache.

refresh_func*Callable[[], Awaitable[Any]]

Async function to refresh this cache entry when stale.

View source on GitHub