Design a robust image loading library from scratch for a mobile app at xAI. How would you handle caching, cancellation, and memory pressure?