如何使用Builder模式设置Cache-Control标头?

时间:2016-06-16 00:13:38

标签: cache-control okhttp3

我试图重写

def run_process(self, resource_generator, chain_signature):
    for resources in resource_generator:
        chain_signature(resources)

作为

request = request.newBuilder()
                 .header("Cache-Control", "public, max-age=" + 60)
                 .build();

但它并不等效,因为CacheControl cacheControl = new CacheControl.Builder() .maxAge(1, TimeUnit.MINUTES) .noCache() .build(); request.newBuilder() .cacheControl(cacheControl) .build(); 指令不在public标题中。如何使用Cache-Control

进行设置

0 个答案:

没有答案