缓存管理
所有文档

          内容分发网络 CDN

          缓存管理

          下列代码中对函数入参c即是CdnClient对象,详情参见CdnClient

          刷新缓存

          def test_purge(c):
              """
              test_purge
              """
              tasks = []
              tasks.append({'url': 'http://example.test.com/1.jpg'})
              tasks.append({'url': 'http://example.test.com/', "type":"directory"})
              response = c.purge(tasks)
              print(response)

          查询刷新结果

          def test_list_purge_tasks(c):
              """
              test_list_purge_tasks
              """
              response = c.list_purge_tasks(
                          id = 'cb8eb1cf-b257-4426-8ac8-59c47b19a351',
                          url = 'http://example.test.com/1.jpg',
                          startTime = '2018-01-11T11:00:00Z',
                          endTime = '2018-01-11T12:50:00Z'
                          )
              print(response)

          预热缓存

          def test_prefetch(c):
              """
              test_prefetch
              """
              tasks = []
              tasks.append({'url': 'http://example.test.com/1.jpg'})
              tasks.append({'url': 'http://example.test.com/2.jpg'})
              response = c.prefetch(tasks)
              print(response)

          查询预热结果

          def test_list_prefetch_tasks(c):
              """
              test_list_prefetch_tasks
              """
              response = c.list_prefetch_tasks(
                      id = 'eJwzNDLXMTSyAAAFfAFi',
                      startTime = '2018-01-11T11:00:00Z',
                      endTime = '2018-01-11T12:50:00Z'
                      )
              print(response)

          操作记录

          def test_get_domain_records(c):
              """
              Query refresh and preload records
              """
          
              Type = "purge"
              start_time = '2019-05-26T00:00:00Z'
              end_time = '2019-05-26T01:00:00Z'
              url = 'http://test-sdk.sys-qa.com/path/to/directory/'
              marker = None
          
              response = c.get_domain_records(Type, start_time, end_time, url, marker)
              print(response)
          上一篇
          加速域名管理
          下一篇
          日志接口