CDN edge cache

CDN 엣지 캐시

A nearby edge stores content so repeated requests avoid a trip to the origin.

···
html
<div class="n-demo"><div class="n-head"><strong>EDGE CACHE ROUTE</strong><span>LIVE TRACE</span></div><div class="n-stage"><div class="edge"><div class="n-box">USER</div><div class="edge-path"><i id="edge-line"></i><span id="edge-label">MISS</span></div><div class="n-box" id="edge-edge">EDGE</div><div class="edge-path"><i id="origin-line"></i></div><div class="n-box" id="edge-origin">ORIGIN</div></div></div><div class="n-foot">tap to step · auto replay</div></div>
css
.n-demo{width:min(94vw,760px);height:min(88vh,324px);padding:clamp(9px,2.2vmin,18px);border:1px solid var(--line);border-radius:13px;background:var(--surface);display:flex;flex-direction:column;gap:clamp(5px,1.3vmin,10px);font:600 clamp(12px,2.4vmin,16px)/1.3 "Pretendard Variable",Pretendard,-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo",sans-serif;overflow:hidden}.n-head,.n-foot{display:flex;justify-content:space-between;align-items:center;color:var(--muted)}.n-head strong{color:var(--accent)}.n-head span,.n-foot{font-size:12px}.n-stage{flex:1;min-height:0;position:relative;display:flex;align-items:center;justify-content:center;gap:clamp(4px,1vmin,10px)}.mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.n-box{padding:clamp(5px,1.5vmin,11px);border:1px solid var(--line);border-radius:8px;background:var(--bg);text-align:center}.n-on{border-color:var(--accent)!important;color:var(--accent)!important;background:color-mix(in srgb,var(--accent) 12%,var(--surface))!important}.n-muted{color:var(--muted)}@media(max-width:400px){.n-head span{display:none}}.edge{width:96%;display:flex;align-items:center;gap:4px}.edge>.n-box{min-width:19%}.edge-path{flex:1;height:3px;background:var(--line);position:relative}.edge-path i{position:absolute;left:0;top:0;width:0;height:100%;background:var(--accent);transition:width .45s}.edge-path span{position:absolute;left:0;top:8px;font-size:12px;color:var(--accent)}
js
let hit=false;function advance(){hit=!hit;document.getElementById('edge-line').style.width='100%';document.getElementById('origin-line').style.width=hit?'0':'100%';document.getElementById('edge-label').textContent=hit?'HIT':'MISS';document.getElementById('edge-origin').style.opacity=hit?'.35':'1';document.getElementById('edge-edge').classList.toggle('n-on',hit)}
const clickTarget=document.querySelector('.n-demo');if(clickTarget&&typeof advance==='function'){advance();const timer=setInterval(advance,1050);clickTarget.addEventListener('pointerdown',()=>{clearInterval(timer);advance()})}

A CDN places cacheable responses at regional edge servers. On a miss, an edge fetches from the origin; while fresh, later requests at that edge return locally.

The demo shortens the route from origin fetch to edge hit. Private responses need careful cache scope and keys.

When to use

Use it to reduce regional latency and origin load for static assets or broadly shared responses.

Open as page ↗