Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
cache.cpython-313.pyc78 linesDownload Raw Back to __pycache__
1�

2��j6��>�SrSSKJr SSKJrJr SSKJr SSKJ	r	J3r4JrJr \"S5r
\SrSSKJr SS	KJr SSKJr SSKJr /SQrSSjrS5S.SSjjrS6S7S8S.SSjjrg9!\a S10rS11rNBf=f!\a S12r"S
S\13\
5rNQf=f)z�Key/value cache for use inside LangGraph deployments.14 15Thin wrapper around ``langgraph_api.cache``.16Values must be JSON-serializable (dicts, lists, strings, numbers, booleans,17``None``).18�)�annotations)�	Awaitable�Callable)�	timedelta)�Any�Generic�Literal�TypeVar�T)�miss�fresh�stale�expired)�	cache_get)�	cache_setN)�	SWRResult)�swrc�<�\rSrSr%SrS\S'S\S'S19SSjjrSrg	)r�%z'Result wrapper returned by :func:`swr`.r�value�CacheStatus�statusc��# �g7f)z&Update or revalidate the cached value.N�)�selfrs  �YD:\code\apps\devtools\python\user_packages\Python313\site-packages\langgraph_sdk/cache.py�mutate�SWRResult.mutate+s����s�rN).)rr�returnr)�__name__�20__module__�__qualname__�__firstlineno__�__doc__�__annotations__r�__static_attributes__r�rrr%s��5�����	�	r'r)rrrrc��X# �[c[S5e[U5IShv�N$N7f)z�Get a value from the cache.21 22Returns the deserialized value, or ``None`` if the key is missing or expired.23 24Requires Agent Server runtime version 0.7.29 or later.25N�yCache is only available server-side within the LangGraph Agent Server (https://docs.langchain.com/langsmith/deployments).)�26_cache_get�RuntimeError)�keys rrr8s2������
B�27�	28��C�� � � �s�!*�(�*)�ttlc��\# �[c[S5e[XU5IShv�N gN7f)a	Set a value in the cache.29 30Args:31    key: The cache key.32    value: The value to cache (must be JSON-serializable).33    ttl: Optional time-to-live. Capped at 1 day; ``None`` or zero34        defaults to 1 day.35 36Requires Agent Server runtime version 0.7.29 or later.37Nr))�38_cache_setr+)r,rr-s   rrrGs2������
B�39�	40��S��41%�%�%�s�",�*�,��	fresh_for�max_age�modelc��# �[c[S5eUc[S5nUc	[SS9n[XX#US9IShv�N$N7f)a�Load a cached value using stale-while-revalidate semantics.42 43This helper is server-side only and is intended for caching internal async44dependencies such as auth or metadata lookups.45 46Args:47    key: Cache key.48    loader: Async callable that fetches the value on miss/revalidation.49    fresh_for: How long a cached value is considered fresh (no revalidation).50        Defaults to ``timedelta(0)`` so every access triggers a background51        revalidate while still returning the cached value instantly. Values52        above :data:`MAX_CACHE_TTL` are clamped to the backend maximum.53    max_age: Total lifetime of a cached entry. After this, the next access54        blocks on the loader. Defaults to :data:`MAX_CACHE_TTL` (24 h by55        default). Values above :data:`MAX_CACHE_TTL` are clamped to the56        backend maximum.57    model: Optional Pydantic model class. When provided, values are58        serialized via ``model_dump(mode="json")`` before storage and59        deserialized via ``model.model_validate()`` on read.60 61Returns:62    An :class:`SWRResult` with ``.value``, ``.status``, and an async63    ``.mutate()`` method.64 65Semantics:66- cache miss: await ``loader()``, store the value, return it67- fresh hit (age < fresh_for): return the cached value68- stale hit (fresh_for <= age < max_age): return the cached value69  immediately and trigger a best-effort background refresh70- expired (age >= max_age): await ``loader()``, store the value, return it71Nr)r�)�daysr0)�_api_swrr+r)r,�loaderr1r2r3s     rrrZs_���N���
B�72�	73����a�L�	�����#����y������s�;A�A�A)r,�strrz74Any | None)r,r9rrr-�timedelta | Noner�None)r,r9r8zCallable[[], Awaitable[T]]r1r:r2r:r3ztype[T] | NonerzSWRResult[T])r$�75__future__r�collections.abcrr�datetimer�typingrrr	r76rr�langgraph_api.cacherr*rr/�ImportErrorrrr7�__all__rr'r�<module>rCs����#�/��1�1��C�L���9�:��	����-�3� ��!�FJ�&�.#'� $� �
2�	�2�&�2� �	2�77�2��
2��2��C���J��J������H��G�A�J���s"�A3�B�378B�?B�B�B
codekingpro/portable-devtools · Team Ai