From 69adf77e004e197a49b291571940a6bd0a471bd3 Mon Sep 17 00:00:00 2001 From: Grischa Erbe Date: Wed, 29 Apr 2026 22:55:05 +0200 Subject: [PATCH] Trim verbose Response-body comments from README Co-Authored-By: Claude Opus 4.7 (1M context) --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index c44366e..2fea30b 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,7 @@ import { Cacheable, MemoryBucket } from 'cacheables' const cache = new Cacheable('app', { buckets: [new MemoryBucket()] }) -// Cache the parsed JSON, not the Response — a Response body can be -// consumed exactly once, so caching the Response itself would break -// every call after the first .json(). -const data = await cache.remember( - () => fetch('https://some-url.com/api').then((r) => r.json()), - 'key', -) +const data = await cache.remember(() => fetchData(), 'key') ``` - [Installation](#installation) @@ -71,8 +65,6 @@ const cache = new Cacheable('weather-data', { // `remember` is both getter and setter: on a miss it calls the resource // and writes to every bucket; on a hit it returns the cached value. -// Cache the parsed JSON rather than the Response object — the Response -// body can only be read once. const getWeather = () => cache.remember(() => fetch(apiUrl).then((r) => r.json()), 'karlsruhe')