2 Commits

Author SHA1 Message Date
typist
b4ba7a2219 0.0.22
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m52s
2025-10-29 09:11:11 +08:00
typist
25e42e3af5 fix: update caching strategy for ipinfo API in Vite config
- Changed caching handler from 'NetworkFirst' to 'CacheFirst' for improved performance.
- Extended cache expiration time from 5 minutes to 1 hour to enhance data availability.
2025-10-29 09:10:59 +08:00
2 changed files with 3 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "litek", "name": "litek",
"private": true, "private": true,
"version": "0.0.21", "version": "0.0.22",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -32,12 +32,12 @@ export default defineConfig({
runtimeCaching: [ runtimeCaching: [
{ {
urlPattern: /^https:\/\/ipinfo\.io\/.*/i, urlPattern: /^https:\/\/ipinfo\.io\/.*/i,
handler: 'NetworkFirst', handler: 'CacheFirst', // 改为 CacheFirst优先使用缓存
options: { options: {
cacheName: 'ipinfo-cache', cacheName: 'ipinfo-cache',
expiration: { expiration: {
maxEntries: 10, maxEntries: 10,
maxAgeSeconds: 60 * 5 // 5 分钟 maxAgeSeconds: 60 * 60 // 延长到 1 小时
}, },
cacheableResponse: { cacheableResponse: {
statuses: [0, 200] statuses: [0, 200]