diff --git a/components/settings/CacheSettings.tsx b/components/settings/CacheSettings.tsx deleted file mode 100644 index b6ab473..0000000 --- a/components/settings/CacheSettings.tsx +++ /dev/null @@ -1,117 +0,0 @@ -'use client'; - -import { useEffect, useState } from 'react'; -import { Card } from '@/components/ui/Card'; -import { Button } from '@/components/ui/Button'; -import { Icons } from '@/components/ui/Icon'; -import { cacheManager, type CacheStats } from '@/lib/utils/cacheManager'; - -export function CacheSettings() { - const [stats, setStats] = useState(null); - const [loading, setLoading] = useState(false); - - const loadStats = async () => { - const cacheStats = await cacheManager.getCacheStats(); - setStats(cacheStats); - }; - - useEffect(() => { - loadStats(); - const interval = setInterval(loadStats, 10000); - return () => clearInterval(interval); - }, []); - - const handleClearAll = async () => { - if (!confirm('确定要清除所有缓存吗?这将删除所有已下载的视频片段。')) return; - setLoading(true); - try { - await cacheManager.clearAllCache(); - await loadStats(); - } finally { - setLoading(false); - } - }; - - const handleCleanup = async () => { - setLoading(true); - try { - await cacheManager.checkAndCleanup(); - await loadStats(); - } finally { - setLoading(false); - } - }; - - const formatDate = (timestamp: number) => { - if (!timestamp) return '无'; - return new Date(timestamp).toLocaleString('zh-CN'); - }; - - return ( - -
-
-

- - 缓存管理 -

-

- 视频片段缓存自动管理,7天后过期,最大1GB -

-
- - {stats && ( -
-
-
-
缓存条目
-
{stats.totalEntries}
-
-
-
缓存大小
-
{stats.totalSizeMB.toFixed(2)} MB
-
-
- -
-
- 最早缓存 - {formatDate(stats.oldestEntry)} -
-
- 最新缓存 - {formatDate(stats.newestEntry)} -
-
- - {stats.totalSizeMB > 800 && ( -
-
- - 缓存空间即将达到上限 -
-
- )} -
- )} - -
- - -
- -
-

• 缓存会在7天后自动过期

-

• 超过1GB时自动清理最旧的30%

-

• 系统每5分钟自动检查一次

-
-
-
- ); -}