Skip to content

Commit 03672fa

Browse files
committed
feat: add function getCdnRefreshList、getCdnPrefetchList
1 parent f814c8d commit 03672fa

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

src/Qiniu/Cdn/CdnManager.php

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,45 @@ public function refreshUrlsAndDirs(array $urls, array $dirs)
6363
return $this->post($url, $body);
6464
}
6565

66+
/**
67+
* 查询 CDN 刷新记录
68+
*
69+
* @param string $requestId 指定要查询记录所在的刷新请求id
70+
* @param string $isDir 指定是否查询目录,取值为 yes/no,默认不填则为两种类型记录都查询
71+
* @param string $urls 要查询的url列表,每个url可以是文件url,也可以是目录url
72+
* @param string $state 指定要查询记录的状态,取值processing/success/failure
73+
* @param int $pageNo 要求返回的页号,默认为0
74+
* @param int $pageSize 要求返回的页长度,默认为100
75+
* @param string $startTime 指定查询的开始日期,格式2006-01-01
76+
* @param string $endTime 指定查询的结束日期,格式2006-01-01
77+
* @return array
78+
* @link https://developer.qiniu.com/fusion/api/1229/cache-refresh#4
79+
*/
80+
public function getCdnRefreshList(
81+
$requestId = null,
82+
$isDir = null,
83+
$urls = null,
84+
$state = null,
85+
$pageNo = 0,
86+
$pageSize = 100,
87+
$startTime = null,
88+
$endTime = null
89+
) {
90+
$req = array();
91+
\Qiniu\setWithoutEmpty($req, 'requestId', $requestId);
92+
\Qiniu\setWithoutEmpty($req, 'isDir', $isDir);
93+
\Qiniu\setWithoutEmpty($req, 'urls', $urls);
94+
\Qiniu\setWithoutEmpty($req, 'state', $state);
95+
\Qiniu\setWithoutEmpty($req, 'pageNo', $pageNo);
96+
\Qiniu\setWithoutEmpty($req, 'pageSize', $pageSize);
97+
\Qiniu\setWithoutEmpty($req, 'startTime', $startTime);
98+
\Qiniu\setWithoutEmpty($req, 'endTime', $endTime);
99+
100+
$body = json_encode($req);
101+
$url = $this->server . '/v2/tune/refresh/list';
102+
return $this->post($url, $body);
103+
}
104+
66105
/**
67106
* @param array $urls 待预取的文件链接数组
68107
*
@@ -81,6 +120,42 @@ public function prefetchUrls(array $urls)
81120
return $this->post($url, $body);
82121
}
83122

123+
/**
124+
* 查询 CDN 预取记录
125+
*
126+
* @param string $requestId 指定要查询记录所在的刷新请求id
127+
* @param string $urls 要查询的url列表,每个url可以是文件url,也可以是目录url
128+
* @param string $state 指定要查询记录的状态,取值processing/success/failure
129+
* @param int $pageNo 要求返回的页号,默认为0
130+
* @param int $pageSize 要求返回的页长度,默认为100
131+
* @param string $startTime 指定查询的开始日期,格式2006-01-01
132+
* @param string $endTime 指定查询的结束日期,格式2006-01-01
133+
* @return array
134+
* @link https://developer.qiniu.com/fusion/api/1227/file-prefetching#4
135+
*/
136+
public function getCdnPrefetchList(
137+
$requestId = null,
138+
$urls = null,
139+
$state = null,
140+
$pageNo = 0,
141+
$pageSize = 100,
142+
$startTime = null,
143+
$endTime = null
144+
) {
145+
$req = array();
146+
\Qiniu\setWithoutEmpty($req, 'requestId', $requestId);
147+
\Qiniu\setWithoutEmpty($req, 'urls', $urls);
148+
\Qiniu\setWithoutEmpty($req, 'state', $state);
149+
\Qiniu\setWithoutEmpty($req, 'pageNo', $pageNo);
150+
\Qiniu\setWithoutEmpty($req, 'pageSize', $pageSize);
151+
\Qiniu\setWithoutEmpty($req, 'startTime', $startTime);
152+
\Qiniu\setWithoutEmpty($req, 'endTime', $endTime);
153+
154+
$body = json_encode($req);
155+
$url = $this->server . '/v2/tune/prefetch/list';
156+
return $this->post($url, $body);
157+
}
158+
84159
/**
85160
* @param array $domains 待获取带宽数据的域名数组
86161
* @param string $startDate 开始的日期,格式类似 2017-01-01

0 commit comments

Comments
 (0)