Skip to content

Commit e0492c5

Browse files
Refactor ETag cache mode into separate plugin
1 parent fe9ef73 commit e0492c5

7 files changed

Lines changed: 868 additions & 722 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
### Added
88

9-
- Added an `etag_only` option to cache only ETag-backed responses and always revalidate them before serving cached bodies.
9+
- Added `EtagCachePlugin` to cache only ETag-backed responses and always revalidate them before serving cached bodies.
1010

1111
## 2.0.2 - 2025-12-01
1212

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ composer require php-http/cache-plugin
2323

2424
Please see the [official documentation](http://docs.php-http.org/en/latest/plugins/cache.html).
2525

26-
To only cache ETag-backed responses and always revalidate cached bodies with `If-None-Match`, enable `etag_only`:
26+
To only cache ETag-backed responses and always revalidate cached bodies with `If-None-Match`, use `EtagCachePlugin`:
2727

2828
``` php
29-
$plugin = CachePlugin::clientCache($pool, $streamFactory, [
30-
'etag_only' => true,
31-
]);
29+
$plugin = EtagCachePlugin::clientCache($pool, $streamFactory);
3230
```
3331

34-
When this option is enabled, responses without an `ETag` header are not cached. Cached responses are only returned after the origin replies with `304 Not Modified`.
32+
Responses without an `ETag` header are not cached. Cached responses are only returned after the origin replies with `304 Not Modified`.
3533

3634

3735
## Testing

0 commit comments

Comments
 (0)