缓存配置
所有文档

          内容分发网络 CDN

          缓存配置

          设置缓存策略

          $domain = "test.domain.com";
          $rules = array(
              // .jpg后缀缓存一小时
              array(
                  "type" => "suffix",
                  "value" => ".jpg",
                  "ttl" => 3600,
                  "weight" => 30,
              ),
              // /a/b/c/目录下所有文件缓存1800秒
              array(
                  "type" => "path",
                  "value" => "/a/b/c",
                  "ttl" => 1800,
                  "weight" => 15,
              )
          );
          $resp = $client->setDomainCacheTTL($domain, $rules);
          print_r($resp);

          获取缓存策略配置

          $domain = "test.domain.com";
          $resp = $client->getDomainCacheTTL($domain);
          print_r($resp);

          设置缓存参数过滤规则

          $domain = "test.domain.com";
          // flag为true,表示带参数缓存
          $flag = true;
          $resp = $client->setDomainCacheFullUrl($domain, $flag);
          print_r($resp);

          查询缓存参数过滤规则

          $client = new CdnClient($g_CDN_TEST_CONFIG);
          $domain = "test-sdk.sys-qa.com";
          $resp = $client->getDomainCacheFullUrl($domain);
          print_r($resp);

          设置自定义错误码页面

          $errorPage = array(
              'errorPage' => array(
                  array(
                      'code' => 404,
                      "redirectCode" => 302,
                      "url" => "customer_404.html"
                  ),
                  array(
                      'code' => 403,
                      "url" => "customer_403.html"
                  )
              )
          );
          
          $client = new CdnClient($g_CDN_TEST_CONFIG);
          $domain = "test-sdk.sys-qa.com";
          $resp = $client->setDomainErrorPage($domain, $errorPage);
          print_r($resp)

          查询自定义错误码页面

          $client = new CdnClient($g_CDN_TEST_CONFIG);
          $domain = "test-sdk.sys-qa.com";
          $resp = $client->getDomainErrorPage($domain);
          print_r($resp);
          上一篇
          获取加速域名配置
          下一篇
          回源配置