Home  >  Article  >  Backend Development  >  How to clear MIP-cache cache in php batches (with examples)

How to clear MIP-cache cache in php batches (with examples)

不言
不言forward
2019-01-18 09:53:344239browse

The content of this article is about the method of batch clearing MIP-cache cache in PHP (with examples). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

What is MIP? I won’t say much more.

What is MIPCache?

Popular science: MIPCache is a proxy-based CDN caching system. It can be used to cache all MIP pages that are referenced by a certain degree-related page or clicked from Baidu-related services. When a user accesses a MIP page cached by MIPCache, the traffic will first reach the CDN. At this time, if there is relevant page content in the CDN, it will be returned directly to the user. Otherwise, the Cache system will get the MIP page information from a certain web library or a third-party website. , place the CDN cache and return it to the user. While caching, MIPCache also converts absolute paths in the page to relative paths. This operation will make all HTTP requests come from the same source, further improving response speed.

There is a MIPCache cleaning in the background of a certain webmaster tool, but it can only clean one URL at a time and most of them are restricted. As the saying goes, time is money. Can this efficiency be worthy of my monthly salary of 2,000? Not to mention the issue of money and efficiency, it is estimated that if you have to clear more than 10,000 items, it will become very boring and annoying. I love work, work makes me happy! However, Goose is limited to clearing the cache only 10 times in 100 seconds, which is simply a big pain point. SO. . .

Of course, there is nothing I can do. After all, this is a certain product, and it has to be made how it should be made according to other people’s rules.

after that. . . Damn, am I telling a story? Without further ado, let’s go straight to the topic

Some Degree’s LatestMIPCache CleanupInterface (maybe some people haven’t discovered it yet and I only found out about it recently) Someone in the group happened to ask why it couldn’t be used

How to use

1. First, obtain the authkey from the MIP of a certain webmaster platform.

2. MIPCache batch cleanup interface

3. PHP call example

<?php
$api = &#39;https://c.mipcdn.com/update-ping/refreshcache&#39;;//批量清理mip cache接口
$postData = array(
      "host" => "svip7.cc",//你的域名
      "path" => "/mip",//需要清理的文件夹名称
      "authkey" => "660ab33e028cec9f443da9c3abfcdefg"//你的AUTHKEY
      );
$postData = json_encode($postData);
$url = $api;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$result = curl_exec($ch);
curl_close($ch);
echo "返回状态".$result;
?>

4. Return status

Usage restrictions: The daily cleaning limit for a single site is 100,000 URLs. Please evaluate the magnitude by yourself when submitting a path request. If the site URL is more than one million, avoid submitting / directly. It is recommended to submit paths hierarchically as needed.

Effective time: The effective time of 1w level URL is about 1 hour.

Notes

1. Note: After cleaning the Cache, the MIP-cache spider will return to the origin site to crawl the content. If the number of submitted URLs is too large, it will The website's server causes a certain amount of pressure. Therefore, when clearing the Cache, please pay attention to the endurance of your own site server.

2. MIP Cache UA is different from certain search mobile UA.

The above is the detailed content of How to clear MIP-cache cache in php batches (with examples). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete