@oss-autopilot/core - v1.6.3
    Preparing search index...

    Class HttpCache

    File-based HTTP cache backed by ~/.oss-autopilot/cache/.

    Each cache entry is stored as a separate JSON file keyed by the SHA-256 hash of the request URL. This avoids filesystem issues with URL-based filenames and keeps lookup O(1).

    Index

    Constructors

    Methods

    • Remove stale entries older than maxAgeMs from the cache directory. Intended to be called periodically (e.g., once per daily run).

      Parameters

      • maxAgeMs: number = DEFAULT_MAX_AGE_MS

      Returns number

    • Return the cached body if the entry exists and is younger than maxAgeMs. Useful for time-based caching where ETag validation isn't applicable (e.g., caching aggregated results from paginated API calls).

      Parameters

      • key: string
      • maxAgeMs: number

      Returns unknown

    • Get the in-flight promise for a URL (for deduplication).

      Parameters

      • url: string

      Returns Promise<unknown> | undefined

    • Check whether a URL has an in-flight request.

      Parameters

      • url: string

      Returns boolean

    • Store a response with its ETag.

      Parameters

      • url: string
      • etag: string
      • body: unknown

      Returns void

    • Register an in-flight request for deduplication. Returns a cleanup function to call when the request completes.

      Parameters

      • url: string
      • promise: Promise<unknown>

      Returns () => void

    • Return the number of entries currently in the cache.

      Returns number