@@ -58,7 +58,7 @@ final class CachePlugin implements Plugin
5858 * bool respect_cache_headers: Whether to look at the cache directives or ignore them
5959 * int default_ttl: (seconds) If we do not respect cache headers or can't calculate a good ttl, use this value
6060 * 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
6262 * we have to store the cache for a longer time than the server originally says it is valid for.
6363 * We store a cache item for $cache_lifetime + max age of the response.
6464 * string[] methods: list of request methods which can be cached
@@ -230,7 +230,7 @@ private function calculateCacheItemExpiresAfter(?int $maxAge): ?int
230230 return null ;
231231 }
232232
233- return $ this ->config ['cache_lifetime ' ] + $ maxAge ;
233+ return ( $ this ->config ['cache_lifetime ' ] ?: 0 ) + ( $ maxAge ?: 0 ) ;
234234 }
235235
236236 /**
@@ -368,7 +368,7 @@ private function configureOptions(OptionsResolver $resolver): void
368368 $ resolver ->setAllowedTypes ('default_ttl ' , ['int ' , 'null ' ]);
369369 $ resolver ->setAllowedTypes ('respect_cache_headers ' , ['bool ' , 'null ' ]);
370370 $ 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 ]);
372372 $ resolver ->setAllowedTypes ('blacklisted_paths ' , 'array ' );
373373 $ resolver ->setAllowedValues ('hash_algo ' , hash_algos ());
374374 $ resolver ->setAllowedValues ('methods ' , function ($ value ) {
0 commit comments