@@ -58,7 +58,7 @@ final class CachePlugin implements Plugin
58
58
* bool respect_cache_headers: Whether to look at the cache directives or ignore them
59
59
* int default_ttl: (seconds) If we do not respect cache headers or can't calculate a good ttl, use this value
60
60
* string hash_algo: The hashing algorithm to use when generating cache keys
61
- * int cache_lifetime: (seconds) To support serving a previous stale response when the server answers 304
61
+ * int|null cache_lifetime: (seconds) To support serving a previous stale response when the server answers 304
62
62
* we have to store the cache for a longer time than the server originally says it is valid for.
63
63
* We store a cache item for $cache_lifetime + max age of the response.
64
64
* string[] methods: list of request methods which can be cached
@@ -230,7 +230,7 @@ private function calculateCacheItemExpiresAfter(?int $maxAge): ?int
230
230
return null ;
231
231
}
232
232
233
- return $ this ->config ['cache_lifetime ' ] + $ maxAge ;
233
+ return ( $ this ->config ['cache_lifetime ' ] ?: 0 ) + ( $ maxAge ?: 0 ) ;
234
234
}
235
235
236
236
/**
@@ -368,7 +368,7 @@ private function configureOptions(OptionsResolver $resolver): void
368
368
$ resolver ->setAllowedTypes ('default_ttl ' , ['int ' , 'null ' ]);
369
369
$ resolver ->setAllowedTypes ('respect_cache_headers ' , ['bool ' , 'null ' ]);
370
370
$ resolver ->setAllowedTypes ('methods ' , 'array ' );
371
- $ resolver ->setAllowedTypes ('cache_key_generator ' , ['null ' , ' Http\Client\Common\Plugin\Cache\Generator\ CacheKeyGenerator' ]);
371
+ $ resolver ->setAllowedTypes ('cache_key_generator ' , ['null ' , CacheKeyGenerator::class ]);
372
372
$ resolver ->setAllowedTypes ('blacklisted_paths ' , 'array ' );
373
373
$ resolver ->setAllowedValues ('hash_algo ' , hash_algos ());
374
374
$ resolver ->setAllowedValues ('methods ' , function ($ value ) {
0 commit comments