From b1e2c8fd5cb5dfa46bc440a12eafaf56cd844b1c Mon Sep 17 00:00:00 2001 From: Philipp Tanlak Date: Mon, 24 Nov 2025 20:54:57 +0100 Subject: Docs --- content/docs/configuration/caching.md | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 content/docs/configuration/caching.md (limited to 'content/docs/configuration/caching.md') diff --git a/content/docs/configuration/caching.md b/content/docs/configuration/caching.md new file mode 100644 index 0000000..2c6766a --- /dev/null +++ b/content/docs/configuration/caching.md @@ -0,0 +1,36 @@ +--- +title: 'Caching' +weight: 7 +--- + +The `cache` config option allows you to enable file-based request caching. When enabled every request cached with its raw response. When the cache is populated and you re-run the scraper, requests will be served directly from cache. + +This also allows you to modify your scraping script afterwards and collect new results immediately. + +```javascript {filename="Configuration"} +export const config = { + url: "http://example.com/", + cache: "file", + // ... +}; +``` + +### Cache File + +When caching is enabled using the `cache: "file"` option, a `.cache` file will be created with the name of your scraping script. + +```bash {filename="Terminal"} +$ flyscrape run hackernews.js # Will populate: hackernews.cache +``` + +### Shared cache + +In case you want to share a cache between different scraping scripts, you can specify where to store the cache file. + +```javascript {filename="Configuration"} +export const config = { + url: "http://example.com/", + cache: "file:/some/path/shared.cache", + // ... +}; +``` -- cgit v1.2.3