Page 1 of 1

Menene gaba don caching gefen akan Netlify?

Posted: Mon Dec 23, 2024 9:39 am
by asikurrahmanshuvo
Netlify Edge nodes kuma suna iya ɗaukar Buƙatun Samun Sharadi don abun ciki wanda kuke son gujewa haɓakawa bayan sabon turawa. Anan ga ƙaramin tweak zuwa aikin da ke sama:

A wannan yanayin, idan kun tura wannan aikin kuma ku ziyarce shi daga kullin gefen, kirtani "Sannu, Duniya" za a adana shi akan Netlify Edge. Idan kun yi sabon turawa ba tare da canje-canje ga aikin ba, to a karon farko da kuka ziyarci aikin, Node ɗin mu zai aika da buƙatu zuwa aikin tare da taken Idan-Babu-Match. Ayyukan zai gano wannan kuma ya mayar da martani mara kyau na 304, yana gaya wa Netlify Edge ya ci gaba da yin amfani da amsa daga cache.

SWR (sake-lokacin sake ingantawa)
Wata dabara mai ƙarfi ta caching ita ce tsarin “stale- while-revalidate” tsarin. Wannan tsarin yana gaya wa Edge ɗin mu don ba da amsawar da aka adana ko da lokacin da ya ƙare, amma sake sabunta shi a bango ba tare da buƙatar abokin ciniki ya jira sakamakon ba.

Ga misalin aiki ta amfani da stale yayin sake ingantawa:

Wannan aikin yana kunshe da API Rest na jama'a wanda takamaiman database ta masana'antu zai iya ɗaukar ɗan lokaci don dawowa kuma yana iya kasancewa ƙarƙashin ƙayyadaddun iyaka.

Idan kun tura wannan kuma ku ziyarci aikin, za a yi amfani da buƙatun farko daga aikin, adanawa a cikin Edge Cache, sannan lokacin da kuka sabunta mai binciken, zaku lura cewa martanin masu zuwa suna nan take kuma suna aiki daga Netlify Edge. .

Idan wannan ƙarshen ƙarshen yana da dubban baƙi na lokaci ɗaya, bayan nauyin aikin farko, kowannensu zai ci gaba da samun amsawar cache, yayin da kumburin gefen mu zai ci gaba da sabunta abin da aka adana a bango ta hanyar aika buƙatu ɗaya lokaci guda zuwa aikin mara amfani, kare API ɗin da ke ƙasa daga cunkoson ababen hawa da isar da martani nan take ga kowane mai amfani.

Mun ƙirƙiri ma'ajiyar demo inda zaku iya bincika waɗannan samfuran da kanku kuma ku gan su a cikin aiki a gefen Netlify a dandalin demo .

Muna farin cikin isar da wannan matakin iko na gaba akan ma'ajiyar gefen Netlify ga ku duka, kuma muna da taswirar ci gaba zuwa ainihin tushen dandalin mu wanda muke da himma don rabawa tare da duniya a cikin watanni masu zuwa.

Yi tsammanin ƙarin iko akan tsarin caching gefen, ingantattun gogewa da rubuta ayyukan Netlify da ƙarin zaɓuɓɓuka don ci gaba da amsawa a wajen Ginawa da Atomic Deploys.