Cache Management
Last Updated:2020-09-17
Purge Cache
def test_purge(self):
"""
test_purge
"""
error = None
try:
tasks = []
tasks.append({'url': 'http://opencdn3.sys-qa.com/1.jpg'})
tasks.append({'url': 'http://opencdn3.sys-qa.com/', "type":"directory"})
response = self.cdn_client.purge(tasks)
print response
except BceServerError as e:
error = e
finally:
self.assertIsNone(error)
Query Purge Results
def test_list_purge_tasks(self):
"""
test_list_purge_tasks
"""
error = None
try:
response = self.cdn_client.list_purge_tasks(
id = 'eJwztjA3swQAAy4BEg==',
url = 'http://opencdn3.sys-qa.com/1.jpg',
startTime = '2017-01-18T10:00:00Z',
endTime = '2017-01-18T12:50:00Z')
print response
except BceServerError as e:
error = e
finally:
self.assertIsNone(error)
Prefetch Cache
def test_prefetch(self):
"""
test_prefetch
"""
error = None
try:
tasks = []
tasks.append({'url': 'http://opencdn3.sys-qa.com/1.jpg'})
tasks.append({'url': 'http://opencdn3.sys-qa.com/2.jpg'})
response = self.cdn_client.prefetch(tasks)
print response
except BceServerError as e:
error = e
finally:
self.assertIsNone(error)
Query Prefetching Result
def test_list_prefetch_tasks(self):
"""
test_list_prefetch_tasks
"""
error = None
try:
response = self.cdn_client.list_prefetch_tasks(
id = 'c942f806-1246-5870-e724-1d579b56d438',
startTime = '2017-01-18T10:00:00Z',
endTime = '2017-01-18T12:50:00Z')
print response
except BceServerError as e:
error = e
finally:
self.assertIsNone(error)
Operation Records
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)