Baidu AI Cloud
中国站

百度智能云

CDN

Cache Configuration Interface

Set Cache Expiration Rules

 public void testSetDomainCacheTTL() { 
        SetDomainCacheTTLRequest request = new SetDomainCacheTTLRequest() 
                .withDomain(DOMAIN) 
                .addCacheTTL(new CacheTTL().withType("suffix").withValue(".jpg").withTtl(3600)) 
                .addCacheTTL(new CacheTTL().withType("suffix").withValue(".png").withTtl(3600)) 
                .addCacheTTL(new CacheTTL().withType("path").withValue("/").withTtl(86400)); 
        SetDomainCacheTTLResponse response = cdnClient.setDomainCacheTTL(request); 
        System.out.println(response); 
    } 

Query Cache Expiration Rules

public void testGetDomainCacheTTL() { 
        String domain="vd3.bdstatic.com"; 
        GetDomainCacheTTLResponse response = cdnClient.getDomainCacheTTL(domain); 
        System.out.println(response); 
    } 

Set Cached Parameter Filtration Rules

    public void testSetDomainCacheFullUrl() { 
        String domain="vd3.bdstatic.com"; 
        cdnClient.setDomainCacheFullUrl(DOMAIN, false); 
    } 

Query Cached Parameter Filtration Rules

 public void getDomainsCacheFullUrl() throws Exception { 
        String domain = "testcx100.taobao.com"; 
        GetDomainCacheFullUrlResponse response = cdnClient.getDomainCacheFullUrl(domain); 
        System.out.println(response); 
 } 

Set Customized Error Code Page

public void setSelfErrorPage()throws Exception{ 
        ErrorPage errorPage1=new ErrorPage(404,302,"/customer_404.html"); 
        ErrorPage errorPage2=new ErrorPage(403,"/customer_403.html"); 
        List<ErrorPage> errorPages=new ArrayList<ErrorPage>(); 
        errorPages.add(errorPage2);errorPages.add(errorPage1); 
        String domain="vd1.bdstatic.com"; 
        SetSelfErrorPageResponse response = cdnClient.setSelfErrorPage(domain, errorPages); 
        System.out.println(response); 
    } 

Query Custom Error Page

public void getSelfErrorPage(){ 
        String domain="vd3.bdstatic.com"; 
        GetSelfErrorPageResponse response = cdnClient.getSelfErrorPage(domain); 
        System.out.println(response); 
    } 
Previous
Acceleration Domain Name Configuration
Next
Statistics and Log Interface