Bayan ajiya mai sauƙi, akwai cikakke dabbobin ajiya — ajiya-gida, rubutu-zuwa, rubutu-baya, karanta-zuwa — kowanne tare da bambancin daidaito da samun aiki. Fahimtar su (da yadda ake cire assusu) yana taimaka ka ƙera ajiyar aiki da dace.
Ajiya-gida (jigon ɗatowa — mafi santsi)
App checks cache → miss → load from DB → populate cache → return.
✓ Only requested data is cached (efficient); resilient (works if cache is down)
✗ First request is a miss (slower); cache can be stale until TTL/invalidation
→ The default, most common strategy.
Rubutu-zuwa da rubutu-baya
WRITE-THROUGH → write to cache AND DB together (synchronously) on every write
✓ Cache always fresh/consistent ✗ Writes are slower (two writes); caches unread data
WRITE-BEHIND (write-back) → write to cache immediately, write to DB ASYNC later
✓ Fast writes ✗ Risk of data loss if cache fails before the DB write; more complex
