tencent-cdn-refresh
v2.0.0
Published
Refresh tencent cdn cache.
Downloads
36
Maintainers
Readme
说明
通过 腾讯云无服务器云函数,自动刷新 CDN 缓存。
通过腾讯云无服务器云函数刷新时,需要「执行方法」改为: scf.main_handler
使用
登录腾讯云无服务器云函数 管理后台,新建云函数并上传 Zip
代码包。
云函数暂不支持直接引入已发布到
npm
的package
,可通过zip
打包方式上传。
点击 这里 下载 ZIP 文件。
也可以将仓库克隆到本地后打开 example 这个目录,之后输入 npm install
安装依赖,最后直接使用 SCF的 VSCode 插件
上传这个目录即可。
上传成功后,新增两个环境变量 SECRET_ID
及 SECRET_KEY
,添加 触发方式 后即可查看实际的运行效果。
更多资料请参考官方文档。另外你可能需要 对象存储 COSCMD 工具 来自动上传你本地的资源文件。
接口
安装依赖并使用
npm install tencent-cdn-refresh
import Refresher from 'tencent-cdn-refresh'
const refresher = new Refresher({
SecretId: '',
SecretKey: ''
});
refresher.purgeUrlsCache('url1');
// refresher.purgeDirsCache('dir1');