feat: 插件使用说明(usage)+ 页面缓存命中统计

- plugin.json 新增 usage 字段(多行文本),后台插件卡片折叠展示;四个内置插件补齐使用说明
- PageCacheMiddleware 记录命中/未命中计数(按日滚动),仪表盘新增「页面缓存」统计卡(条目数 + 命中率),用于判断前台缓存效果、是否需额外加速
- 文档与测试同步
This commit is contained in:
ak
2026-08-12 03:57:22 +08:00
parent 22df17f02a
commit 01861f8809
10 changed files with 60 additions and 5 deletions
+5
View File
@@ -17,6 +17,8 @@ class BlogStats extends BaseWidget
protected function getStats(): array
{
$cache = \App\Blog\Support\PageCacheMiddleware::stats();
return [
Stat::make('文章', Post::published()->count())
->description('总浏览量 '.number_format((float) Post::sum('views')))
@@ -26,6 +28,9 @@ class BlogStats extends BaseWidget
->icon('heroicon-o-chat-bubble-left-right'),
Stat::make('用户', User::count())
->icon('heroicon-o-users'),
Stat::make('页面缓存', $cache['count'].' 条')
->description('命中率 '.$cache['rate'].'%(命中 '.$cache['hits'].' / 未命中 '.$cache['misses'].',按日滚动)')
->icon('heroicon-o-bolt'),
];
}
}