AniLink - v3.0.0
    Preparing search index...

    Function tryCacheRead

    • Reads the response cache for a request and, on a hit, fires the onRequestStart/onResponse hooks with cacheHit: true before returning the cached body.

      The cache-hit hook emissions live here, with the cache policy and not in the transport entry, so the read path's observability contract stays next to the cache it reports on. The transport fires the hooks through the same safeInvoke isolation every other emission uses; the correlation requestId is generated lazily, only when a hook is configured, so the cache-hit fast path of a hook-less hot loop does not pay the UUID generation cost on every call.

      Internal transport helper: exported for the transport module, not part of the package's public API.

      Type Parameters

      • T

      Parameters

      • resolved: ResolvedRequestOptions

        The resolved request options, carrying the cache and hooks.

      • method: HttpMethod

        The HTTP method.

      • url: string

        The request URL.

      • data: string | object | undefined

        The request body, when present.

      • cacheAuthKey: string

        The auth-scoping cache key fragment.

      Returns T | undefined

      The cached response, or undefined on a miss.