apollographql / apollographql/datasource-rest

Unable to prevent reading from the Cache

Open
#291 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
48
Forks
21
PR merge metrics
No merged PRs in 30d

Description

The current implementation will always check the cache regardless of what value is passed in for the `ttl`.

Currently in the file `/src/HTTPCache.ts` on line `78` there is no check of `ttl` before reading from the cache:

```
const entry = await this.keyValueCache.get(cacheKey);
```

The ask would be to provide a conditional check on this line to bypass the read from the cache if `ttl=0` as it is currently impacting the reported miss rate when trying to only inspect the miss rate for queries/request where the cache is actively used.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/HTTPCache.ts at line 78 and inspect how ttl is handled before the cache read. Verify that ttl=0 bypasses the cache lookup while cache-enabled requests retain their current behavior, then confirm the resulting miss-rate behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.