Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ Options:
// Specify where to keep the cache. If undefined, '.cache' is used by default.
// If this directory does not exist, it will be created.
cacheDirectory: '/my/cache/directory/path',
// Time to live. How long (in ms) responses remain cached before being
// automatically ejected. If undefined, responses are never
// automatically ejected from the cache.
// Time to live. How long (in ms) responses remain cached before
// becoming invalid. If undefined, cached responses never become
// invalid.
ttl: 1000,
}

```

If you set a TTL, be aware that cache entries are not actively deleted from disk when they become invalid, which can cause disk bloat over time. To clean that up, you can periodically clear the entire cache directory by calling `.clear()` on an instance of `FileSystemCache`.

### Cache with Redis

Use the [@node-fetch-cache/redis](https://www.npmjs.com/package/@node-fetch-cache/redis) package to cache in Redis.
Expand Down
Loading