百度智能云

All Product Document

          CDN

          Cache Setting

          Set the Cache Policy

          $domain = "test.domain.com"; 
          $rules = array( 
              //Cache .jpg suffix for one hour 
              array( 
                  "type" => "suffix", 
                  "value" => ".jpg", 
                  "ttl" => 3600, 
                  "weight" => 30, 
              ), 
              // /a/b/c/All documents under the directory are cached for 1,800 seconds 
              array( 
                  "type" => "path", 
                  "value" => "/a/b/c", 
                  "ttl" => 1800, 
                  "weight" => 15, 
              ) 
          ); 
          $resp = $client->setDomainCacheTTL($domain, $rules); 
          print_r($resp); 

          Get the Cache Strategy Configuration

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

          Set the Cached Parameter Filtration Rules

          $domain = "test.domain.com"; 
          //If flag is true, it means cache with parameters. 
          $flag = true; 
          $resp = $client->setDomainCacheFullUrl($domain, $flag); 
          print_r($resp); 

          Query the Cached Parameter Filtration Rules

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

          Set the Customized Error Code Page

          $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) 

          Query the Custom Error Code Page

          $client = new CdnClient($g_CDN_TEST_CONFIG); 
          $domain = "test-sdk.sys-qa.com"; 
          $resp = $client->getDomainErrorPage($domain); 
          print_r($resp); 
          Previous
          Access the Acceleration Domain Name Configuration
          Next
          https Setting