1、NSCache简述
官方原文:
SummaryA mutable collection you use to temporarily store transient key-value pairs that are subject to eviction when resources are low.
Declaration@interface NSCache<__covariant KeyType, __covariant ObjectType> : NSObject
DiscussionCache objects differ from other mutable collections in a few ways:
The NSCache class incorporates various auto-eviction policies, which ensure that a cache doesn’t use too much of the system’s memory. If memory is needed by other applications, these policies remove some items from the cache, minimizing its memory footprint.
You can add, remove, and query items in the cache from different threads without having to lock the cache yourself.
Unlike an NSMutableDictionary object, a cache does not copy the key objects that are put into it.
You typically use NSCache objects to temporarily store objects with transient da