#cdn #cache #cache-warmer

app warmer

一个轻量级的CDN缓存预热器。需要sitemap.xml文件才能运行。请参阅README了解如何使用。

2个版本

0.1.2 2023年9月8日
0.1.1 2023年9月5日
0.1.0 2023年9月4日

#5 in #cdn

GPL-3.0-or-later

27KB
282

warmer

用于类似这样的sitemap.xml文件的Rust CDN缓存预热器

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/sitemap.xsl"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
    <loc>https://abh.ai/</loc>
    <lastmod>2022-06-25T20:46Z</lastmod>
    <changefreq>daily</changefreq>
    <priority>1.0</priority>
</url>
<url>
    <loc>https://abh.ai/photos/nature</loc>
    <lastmod>2022-09-25T05:33Z</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.7</priority>
</url>
<url>
    <loc>https://abh.ai/portraits</loc>
    <lastmod>2022-09-24T18:42Z</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.7</priority>
</url>
</urlset>

其他可工作的sitemap示例

用法

下载(从这里)并在Linux上使用以下命令运行可执行二进制文件

warmer http(s)://someurl.com interl
 - ./warmer https://abh.ai 5
 - ./warmer https://abh.ai 1
  • 间隔值应以秒为单位指定,这是预热器在加载sitemap中的下一个URL之前等待的时间。
  • 默认间隔为5秒。不允许使用间隔(0s),但只有在你想要DDoS自己的网站时才使用。
  • 应指定带有方案的完整URL。

从源码构建

  1. 克隆仓库
  2. cd warmer
  3. 安装cargo https://doc.rust-lang.net.cn/cargo/getting-started/installation.html
  4. cargo build --release
  5. 二进制文件将位于target/release文件夹中。它也将被命名为warmer
  6. 你可能需要安装libudev-devlibssl-devopensslpkg-configbuild-essential

使用Docker运行

  1. docker pull abhaisasidharan/warmer
  2. docker run abhaisasidharan/warmer -it warmer https://abh.ai 5

注意

尚不支持包含其他压缩或gzip压缩的sitemap的大sitemap。我会在我有时间时发布它。但对于大多数sitemap,这应该可以很好地预热。目前仅在64位Linux操作系统上受支持。

依赖关系

~17–26MB
~447K SLoC