What is OSCache and how does it behave?
masterOSCache is an open-source re-implementation of NSCache designed to be predictable and debuggable. It functions as an LRU (Least-Recently-Used) cache, meaning objects are discarded oldest-first based on their last access time.
Key behaviors:
- Automatic Eviction: It automatically empties itself when a memory warning occurs.
- NSCache Compatibility: It inherits from
NSCachefor easy drop-in replacement and implements allNSCachemethods. - Limitations: It does not support
NSDiscardableContent;evictsObjectsWithDiscardedContentwill always returnNOregardless of its setting.