缓存配置接口
所有文档

          内容分发网络 CDN

          缓存配置接口

          设置缓存过期规则

           public void setDomainCacheTTL(CdnClient client, String domainName) {
                  SetDomainCacheTTLRequest request = new SetDomainCacheTTLRequest()
                          .withDomain(domainName)
                          .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).withWeigth(5));
                  client.setDomainCacheTTL(request);
              }

          查询缓存过期规则

          public void getDomainCacheTTL(CdnClient client, String domainName) {
                  GetDomainCacheTTLResponse response = client.getDomainCacheTTL(domainName);
              }

          设置缓存参数过滤规则

          public void setDomainCacheFullUrl(CdnClient client, String domainName) {
              SetDomainCacheFullUrlRequest request = new SetDomainCacheFullUrlRequest().withDomain(domainName).withCacheFullUrl(false).addCacheUrlArgs("a");
              client.setDomainCacheFullUrl(request);
          }

          查询缓存参数过滤规则

           public void getDomainsCacheFullUrl(CdnClient client, String domainName) {
                  GetDomainCacheFullUrlResponse response = client.getDomainCacheFullUrl(domainName);
           }

          设置自定义错误码页面

          public void setDomainErrorPage(CdnClient client, String domainName) {
                  ErrorPage errorPage404 = new ErrorPage(404, "/customer_404.html", 302);
                  ErrorPage errorPage403 = new ErrorPage(403, "/custom_403.html");
                  client.setDomainErrorPage(new SetDomainErrorPageRequest()
                          .withDomain(domainName).addErrorPage(errorPage404).addErrorPage(errorPage403));
              }

          查询自定义错误页面

          public void getDomainErrorPage(CdnClient client, String domainName){
                  GetDomainErrorPageResponse response = client.getDomainErrorPage(domainName);
              }

          设置域名缓存共享

           public void setDomainCacheShare(CdnClient client, String domainName) {
                  CacheShare cacheShare = new CacheShare().withEnabled(false);
                  client.setDomainCacheShare(domainName, new SetDomainCacheShareRequest().withCacheShare(cacheShare));
              }

          查询域名缓存共享

           public void getDomainCacheShare(CdnClient client, String domainName){
                  GetDomainCacheShareResponse response = client.getDomainCacheShare(domainName);
              }

          设置移动访问控制

           public void setDomainMobileAccess(CdnClient client, String domainName){
                  MobileAccess mobileAccess = new MobileAccess().withDistinguishClient(true);
                  client.setDomainMobileAccess(new SetDomainMobileAccessRequest()
                          .withDomain(domainName).withMobileAccess(mobileAccess));
              }

          查询移动访问控制

           public void getDomainMobileAccess(CdnClient client, String domainName){
                  GetDomainMobileAccessResponse response = client.getDomainMobileAccess(domainName);
              }
          上一篇
          加速域名配置
          下一篇
          访问配置接口