详情页服务器请求加缓存

This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-06-03 11:09:52 +08:00
parent 4d55eb5a08
commit 8cf779cfc4
76 changed files with 1936 additions and 594 deletions

View File

@@ -3,6 +3,7 @@ import { d as useRuntimeConfig$1, $ as $fetch, w as withQuery, l as hasProtocol,
import { getActiveHead } from 'unhead';
import { defineHeadPlugin } from '@unhead/shared';
import { createMemoryHistory, createRouter, START_LOCATION } from 'vue-router';
import NodeCache from 'node-cache';
import { ssrRenderSuspense, ssrRenderComponent, ssrRenderVNode } from 'vue/server-renderer';
import 'node:http';
import 'node:https';
@@ -611,7 +612,7 @@ const _routes = [
meta: {},
alias: [],
redirect: void 0 ,
component: () => import('./_nuxt/_id_-NSUtO10H.mjs').then((m) => m.default || m)
component: () => import('./_nuxt/_id_-LyIqyA6v.mjs').then((m) => m.default || m)
},
{
name: "index.html",
@@ -619,7 +620,7 @@ const _routes = [
meta: {},
alias: [],
redirect: void 0 ,
component: () => import('./_nuxt/index-a_cE9qns.mjs').then((m) => m.default || m)
component: () => import('./_nuxt/index-IJEZDXen.mjs').then((m) => m.default || m)
},
{
name: "index",
@@ -627,7 +628,7 @@ const _routes = [
meta: {},
alias: [],
redirect: void 0 ,
component: () => import('./_nuxt/index-pqrokjW9.mjs').then((m) => m.default || m)
component: () => import('./_nuxt/index-gOFNKrpA.mjs').then((m) => m.default || m)
},
{
name: "publish",
@@ -635,7 +636,7 @@ const _routes = [
meta: {},
alias: [],
redirect: void 0 ,
component: () => import('./_nuxt/index-UkDLr8N6.mjs').then((m) => m.default || m)
component: () => import('./_nuxt/index-ZqsK41sl.mjs').then((m) => m.default || m)
}
];
function generateRouteKey(route) {
@@ -1048,13 +1049,34 @@ const useId = (deterministicId) => {
const element_plus_injection_plugin_1RNPi6ogby = /* @__PURE__ */ defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.provide(ID_INJECTION_KEY, { "prefix": 1024, "current": 0 });
});
const cache = new NodeCache({
stdTTL: 60,
// 默认过期时间(秒)
checkperiod: 120,
// 清理过期缓存的检查周期(秒)
maxKeys: 1e3
// 最大缓存项数量超过时LRU淘汰
});
const cache_server_TQJuBHlMuU = /* @__PURE__ */ defineNuxtPlugin(() => {
return {
provide: {
cache: {
get: (key) => cache.get(key),
set: (key, value, ttl) => cache.set(key, value, ttl),
del: (key) => cache.del(key),
flush: () => cache.flushAll()
}
}
};
});
const plugins = [
unhead_KgADcZ0jPj,
plugin,
revive_payload_server_eJ33V7gbc6,
components_plugin_KR1HBZs4kY,
element_plus_teleports_plugin_h4Dmekbj62,
element_plus_injection_plugin_1RNPi6ogby
element_plus_injection_plugin_1RNPi6ogby,
cache_server_TQJuBHlMuU
];
const _sfc_main$2 = {
__name: "app",
@@ -1107,8 +1129,8 @@ const _sfc_main$1 = {
const statusMessage = _error.statusMessage ?? (is404 ? "Page Not Found" : "Internal Server Error");
const description = _error.message || _error.toString();
const stack = void 0;
const _Error404 = defineAsyncComponent(() => import('./_nuxt/error-404-ddHl6xOi.mjs').then((r) => r.default || r));
const _Error = defineAsyncComponent(() => import('./_nuxt/error-500-wl8Krfxh.mjs').then((r) => r.default || r));
const _Error404 = defineAsyncComponent(() => import('./_nuxt/error-404-B-qHdSn_.mjs').then((r) => r.default || r));
const _Error = defineAsyncComponent(() => import('./_nuxt/error-500-jFMUKCgz.mjs').then((r) => r.default || r));
const ErrorTemplate = is404 ? _Error404 : _Error;
return (_ctx, _push, _parent, _attrs) => {
_push(ssrRenderComponent(unref(ErrorTemplate), mergeProps({ statusCode: unref(statusCode), statusMessage: unref(statusMessage), description: unref(description), stack: unref(stack) }, _attrs), null, _parent));
@@ -1126,7 +1148,7 @@ const _sfc_main = {
__name: "nuxt-root",
__ssrInlineRender: true,
setup(__props) {
const IslandRenderer = defineAsyncComponent(() => import('./_nuxt/island-renderer-1RMPnle6.mjs').then((r) => r.default || r));
const IslandRenderer = defineAsyncComponent(() => import('./_nuxt/island-renderer-SKIkxSTY.mjs').then((r) => r.default || r));
const nuxtApp = /* @__PURE__ */ useNuxtApp();
nuxtApp.deferHydration();
nuxtApp.ssrContext.url;
@@ -1188,5 +1210,5 @@ let entry;
}
const entry$1 = (ssrContext) => entry(ssrContext);
export { useRuntimeConfig as a, navigateTo as b, createError as c, useNamespace as d, entry$1 as default, useId as e, defaultNamespace as f, debugWarn as g, useRoute as h, useGetDerivedNamespace as i, useIdInjection as j, namespaceContextKey as k, injectHead as l, nuxtLinkDefaults as n, resolveUnrefHeadInput as r, throwError as t, useRouter as u };
export { useRuntimeConfig as a, navigateTo as b, createError as c, useNamespace as d, entry$1 as default, useNuxtApp as e, useId as f, defaultNamespace as g, debugWarn as h, useRoute as i, useGetDerivedNamespace as j, useIdInjection as k, namespaceContextKey as l, injectHead as m, nuxtLinkDefaults as n, resolveUnrefHeadInput as r, throwError as t, useRouter as u };
//# sourceMappingURL=server.mjs.map