Caching महंगे operations (DB queries, computations, external API calls) के परिणामों को store करती है ताकि बार-बार आने वाले requests को काम दोबारा किए बिना तेज़ी से serve किया जा सके। यह एक API के लिए सबसे अधिक प्रभाव वाले performance optimizations में से एक है।
In-memory caching (सबसे तेज़, single-instance)
cache = ();
() {
(cache.(id)) cache.(id);
user = db.(id);
cache.(id, user);
user;
}
