Skip to content

Commit 16cec72

Browse files
authored
fix #91: Change clientCache so it doesn't force no-cache & max-age response directives (#93)
* fix#91: Change clientCache so it doesn't force no-cache & max-age response directives * Update CHANGELOG.md
1 parent 5c591e9 commit 16cec72

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change Log
22

3+
# Version 3
4+
5+
## 3.0.0 - 2025-XX-XX
6+
7+
### Changed
8+
- `clientCache()` will no longer force no-cache & max-age directives to be respected even when `respect_response_cache_directives` is set.
9+
310
# Version 2
411

512
## 2.0.1 - 2024-10-02

src/CachePlugin.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ public function __construct(CacheItemPoolInterface $pool, StreamFactoryInterface
9595
public static function clientCache(CacheItemPoolInterface $pool, StreamFactoryInterface $streamFactory, array $config = [])
9696
{
9797
// Allow caching of private requests
98-
if (\array_key_exists('respect_response_cache_directives', $config)) {
99-
$config['respect_response_cache_directives'][] = 'no-cache';
100-
$config['respect_response_cache_directives'][] = 'max-age';
101-
$config['respect_response_cache_directives'] = array_unique($config['respect_response_cache_directives']);
102-
} else {
98+
if (!\array_key_exists('respect_response_cache_directives', $config)) {
10399
$config['respect_response_cache_directives'] = ['no-cache', 'max-age'];
104100
}
105101

0 commit comments

Comments
 (0)