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;
}
