PageSourceSearch

https://tangzhipeng.cn/_next/static/chunks/1115.a1484a71cf8a4db5.js

js tangzhipeng.cn collected 2026-10-03 20:49:04 UTC 9,015 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1115],{1115:function(e,a,n){"use strict";n.r(a),n.d(a,{AdminCachePanel:function(){return v}});var s=n(7437),i=n(2265),l=n(1994),t=n(2431),c=n(1817),r=n(9076),d=n(9205);let o=(0,d.Z)("CircleGauge",[["path",{d:"M15.6 2.7a10 10 0 1 0 5.7 5.7",key:"1e0p6d"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M13.4 10.6 19 5",key:"1kr7tw"}]]);var h=n(4286);let _=(0,d.Z)("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);var m=n(3247),u=n(6040),p=n(6039),C=n(9788),x=n.n(C);let g=["resettable","lock","runtime","protected"],j={resettable:"可重载缓存",lock:"锁键",runtime:"运行态数据",protected:"受保护键"};function v(e){var a,n,d,C,v;let{token:A,onUnauthorized:b,onNotice:f}=e,[N,P]=(0,i.useState)(null),[k,w]=(0,i.useState)(!0),[S,Z]=(0,i.useState)(!1),[z,E]=(0,i.useState)(""),[R,M]=(0,i.useState)("all"),H=(0,i.useCallback)(async function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];e&&w(!0);try{let e=await u.N.cache.list(A);P(e)}catch(e){if(e instanceof u.k&&401===e.status){b();return}f("error",e instanceof Error?e.message:"缓存列表加载失败")}finally{e&&w(!1)}},[f,b,A]);(0,i.useEffect)(()=>{H()},[H]);let q=null!==(a=null==N?void 0:N.entries)&&void 0!==a?a:[],L=z.trim().toLowerCase(),K=(0,i.useMemo)(()=>q.filter(e=>{var a,n;return("all"===R||e.group===R)&&(!L||"".concat(e.key," ").concat(null!==(a=e.preview)&&void 0!==a?a:""," ").concat(null!==(n=e.protectedReason)&&void 0!==n?n:"").toLowerCase().includes(L))}),[q,R,L]),T=(0,i.useMemo)(()=>{let e=new Map;for(let a of g)e.set(a,[]);for(let n of K){var a;null===(a=e.get(n.group))||void 0===a||a.push(n)}return g.map(a=>{var n;return{group:a,label:j[a],entries:null!==(n=e.get(a))&&void 0!==n?n:[]}}).filter(e=>e.entries.length>0)},[K]);async function V(){if(!S){Z(!0);try{let e=await u.N.cache.reload(A);await H(!1),e.warnings.length>0?f("info","缓存已重载,存在 ".concat(e.warnings.length," 条预热提示")):f("success","缓存已经重载完成")}catch(e){if(e instanceof u.k&&401===e.status){b();return}f("error",e instanceof Error?e.message:"缓存重载失败")}finally{Z(!1)}}}let F=null==N?void 0:N.overview;return(0,s.jsxs)("div",{className:x().wrap,children:[(0,s.jsxs)("section",{className:x().hero,children:[(0,s.jsxs)("div",{className:x().heroCopy,children:[(0,s.jsx)("span",{className:x().eyebrow,children:"SYSTEM \xb7 CACHE"}),(0,s.jsx)("h3",{className:x().title,children:"Redis 缓存维护"}),(0,s.jsx)("p",{className:x().text,children:"这里展示当前 Redis 键空间。业务缓存可重载,统计与运行态数据保留。"})]}),(0,s.jsxs)("div",{className:x().heroActions,children:[(0,s.jsxs)("button",{type:"button",className:x().secondaryAction,onClick:()=>void H(),children:[(0,s.jsx)(t.Z,{size:15}),(0,s.jsx)("span",{children:"刷新列表"})]}),(0,s.jsxs)("button",{type:"button",className:x().primaryAction,onClick:()=>void V(),disabled:S,children:[S?(0,s.jsx)(c.Z,{className:x().spin,size:15}):(0,s.jsx)(r.Z,{size:15}),(0,s.jsx)("span",{children:S?"正在重载":"一键重载缓存"})]})]})]}),(0,s.jsxs)("section",{className:x().metrics,children:[(0,s.jsx)(y,{label:"全部键",value:(0,p.q1)(null!==(n=null==F?void 0:F.totalKeys)&&void 0!==n?n:0),detail:N?"更新于 ".concat(new Date(N.refreshedAt).toLocaleString("zh-CN",{hour12:!1,month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})):"等待扫描",icon:(0,s.jsx)(o,{size:16})}),(0,s.jsx)(y,{label:"可重载",value:(0,p.q1)(null!==(d=null==F?void 0:F.resettableKeys)&&void 0!==d?d:0),detail:"文章 / 标签 / 归档 / 相册 / 搜索",icon:(0,s.jsx)(t.Z,{size:16})}),(0,s.jsx)(y,{label:"运行态",value:(0,p.q1)(null!==(C=null==F?void 0:F.runtimeKeys)&&void 0!==C?C:0),detail:"计数、点赞、收藏、短期去重",icon:(0,s.jsx)(h.Z,{size:16})}),(0,s.jsx)(y,{label:"锁键",value:(0,p.q1)(null!==(v=null==F?void 0:F.lockKeys)&&void 0!==v?v:0),detail:"缓存击穿保护锁",icon:(0,s.jsx)(_,{size:16})})]}),(0,s.jsxs)("section",{className:x().toolbar,children:[(0,s.jsxs)("label",{className:x().searchField,children:[(0,s.jsx)(m.Z,{size:16}),(0,s.jsx)("input",{value:z,onChange:e=>E(e.target.value),placeholder:"搜索 key / 预览 / 保护原因"})]}),(0,s.jsx)("div",{className:x().filters,children:["all",...g].map(e=>(0,s.jsx)("button",{type:"button",className:(0,l.Z)(x().filterChip,R===e&&x().filterChipActive),onClick:()=>M(e),children:"all"===e?"全部":j[e]},e))})]}),k?(0,s.jsxs)("div",{className:x().loadingState,children:[(0,s.jsx)(c.Z,{className:x().spin,size:16}),(0,s.jsx)("span",{children:"正在扫描 Redis 键空间"})]}):0===T.length?(0,s.jsx)("div",{className:x().emptyState,children:"当前筛选条件下没有匹配的缓存键。"}):(0,s.jsx)("div",{className:x().groupStack,children:T.map(e=>(0,s.jsxs)("section",{className:x().groupSection,children:[(0,s.jsxs)("div",{className:x().groupHead,children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:x().groupEyebrow,children:e.label}),(0,s.jsxs)("strong",{children:[(0,p.q1)(e.entries.length)," 个键"]})]}),(0,s.jsx)("span",{className:x().groupMeta,children:"resettable"===e.group?"可被一键重载删除并重新预热":"lock"===e.group?"用于热点缓存互斥":"runtime"===e.group?"运行中状态,默认保留":"未纳入业务缓存白名单"})]}),(0,s.jsx)("div",{className:x().cardGrid,children:e.entries.map(e=>(0,s.jsxs)("article",{className:x().card,"data-group":e.group,children:[(0,s.jsxs)("div",{className:x().cardHead,children:[(0,s.jsx)("strong",{className:x().key,children:e.key}),(0,s.jsxs)("div",{className:x().badges,children:[(0,s.jsx)("span",{className:x().badge,children:e.redisType}),(0,s.jsx)("span",{className:x().badge,children:null==e.ttlSeconds?"TTL ∞":"TTL ".concat(e.ttlSeconds,"s")}),(0,s.jsx)("span",{className:(0,l.Z)(x().badge,e.resettable?x().badgeWarm:x().badgeCool),children:e.resettable?"可重载":"保护中"})]})]}),(0,s.jsxs)("div",{className:x().metaRow,children:[(0,s.jsxs)("span",{children:["规模 ",(0,p.q1)(e.size)]}),(0,s.jsx)("span",{children:j[e.group]})]}),(0,s.jsx)("p",{className:x().preview,children:e.preview||"无预览"}),e.protectedReason?(0,s.jsx)("div",{className:x().reason,children:e.protectedReason}):(0,s.jsx)("div",{className:x().reasonReady,children:"删除后会自动重建并同步公共页面。"})]},e.key))})]},e.group))})]})}function y(e){let{label:a,value:n,detail:i,icon:l}=e;return(0,s.jsxs)("div",{className:x().metricCard,children:[(0,s.jsxs)("div",{className:x().metricHead,children:[(0,s.jsx)("span",{children:a}),l]}),(0,s.jsx)("strong",{children:n}),(0,s.jsx)("small",{children:i})]})}},9076:function(e,a,n){"use strict";n.d(a,{Z:function(){return s}});let s=(0,n(9205).Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])},4286:function(e,a,n){"use strict";n.d(a,{Z:function(){return s}});let s=(0,n(9205).Z)("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
1y:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},9788:function(e){e.exports={wrap:"AdminCachePanel_wrap__j1rdn",hero:"AdminCachePanel_hero__zlW6g",metricCard:"AdminCachePanel_metricCard__EcHb7",toolbar:"AdminCachePanel_toolbar____SKj",groupSection:"AdminCachePanel_groupSection___PYDk",card:"AdminCachePanel_card__fKnjn",loadingState:"AdminCachePanel_loadingState__056Iy",emptyState:"AdminCachePanel_emptyState__UqbK0",heroCopy:"AdminCachePanel_heroCopy__pVTbw",heroActions:"AdminCachePanel_heroActions__G1i51",metrics:"AdminCachePanel_metrics__bkK8n",filters:"AdminCachePanel_filters__h_uWF",groupStack:"AdminCachePanel_groupStack__ylImC",eyebrow:"AdminCachePanel_eyebrow__sVCYF",groupEyebrow:"AdminCachePanel_groupEyebrow__3BJCO",metricHead:"AdminCachePanel_metricHead__0fuEs",groupMeta:"AdminCachePanel_groupMeta__kQLRl",badge:"AdminCachePanel_badge__IwPer",metaRow:"AdminCachePanel_metaRow__Vtn5D",reason:"AdminCachePanel_reason__8njdt",reasonReady:"AdminCachePanel_reasonReady__uPv1Z",title:"AdminCachePanel_title__zhf3V",text:"AdminCachePanel_text__FTm6P",preview:"AdminCachePanel_preview__d669R",groupHead:"AdminCachePanel_groupHead__ll_it",cardHead:"AdminCachePanel_cardHead__EOVAB",badges:"AdminCachePanel_badges__qmf_V",primaryAction:"AdminCachePanel_primaryAction__NQQp1",secondaryAction:"AdminCachePanel_secondaryAction__x0ApZ",filterChip:"AdminCachePanel_filterChip__BCoH8",filterChipActive:"AdminCachePanel_filterChipActive__ELuDi",badgeWarm:"AdminCachePanel_badgeWarm__LXeIY",badgeCool:"AdminCachePanel_badgeCool__eToNI",searchField:"AdminCachePanel_searchField__BEgtH",cardGrid:"AdminCachePanel_cardGrid__vB08d",key:"AdminCachePanel_key__h18s0",spin:"AdminCachePanel_spin__P_3Ml"}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.