Daily iOS
Persistence

NSCache vs custom LRU

NSCache exists, so why do image libraries write their own LRU cache?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

NSCache is thread safe and empties itself under memory pressure, but its eviction policy isn't documented, so it doesn't guarantee LRU and you can't control it, and libraries want a predictable policy, a disk layer, expiry, and measurement.

Share a question