( owner: string, repo: string, result: FetchDocumentationResult, ttl: number, env: Env, )
| 329 | * @param env - Environment with Cloudflare bindings |
| 330 | */ |
| 331 | export async function cacheFetchDocResult( |
| 332 | owner: string, |
| 333 | repo: string, |
| 334 | result: FetchDocumentationResult, |
| 335 | ttl: number, |
| 336 | env: Env, |
| 337 | ): Promise<void> { |
| 338 | try { |
| 339 | const key = getFetchDocCacheKey(owner, repo); |
| 340 | await setInCache(key, result, env, ttl); |
| 341 | console.log( |
| 342 | `Cached fetchDocumentation result for ${owner}/${repo} with TTL ${ttl}s`, |
| 343 | ); |
| 344 | } catch (error) { |
| 345 | console.warn("Failed to save fetchDoc result to cache:", error); |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | // 12h matches the KV cache TTL used elsewhere |
| 350 | const AUTORAG_CACHE_TTL = 60 * 60 * 12; |
no test coverage detected