内容分发网络CDN

    缓存配置接口

    设置缓存过期规则

     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);
        }

    查询缓存过期规则

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

    设置缓存参数过滤规则

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

    查询缓存参数过滤规则

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

    设置自定义错误码页面

    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);
        }

    查询自定义错误页面

    public void getSelfErrorPage(){
            String domain="vd3.bdstatic.com";
            GetSelfErrorPageResponse response = cdnClient.getSelfErrorPage(domain);
            System.out.println(response);
        }
    上一篇
    加速域名配置
    下一篇
    访问配置接口