Take a look at the documentation and sample code .
An NSCache object is a collection-like container or cache that stores key-value pairs similar to the NSDictionary class.
Here's a good explanation Nick Zitzmann.
NSCache is similar to NSMutableDictionary, with differences:
1. It is guaranteed that it will be thread safe.
2. Access to it is much slower. 3. It may drop objects from time to time. You can set costs and limits, but they are not guaranteed. 4. This is not a free connection to anything in CoreFoundation.
5. You cannot request the number of objects in the cache.
6. You cannot list the cache.
I can only recommend using NSCache to store objects that you don't care about whether they were arbitrarily destroyed. If objects should not be or if access speed is a problem, then use NSMutableDictionary instead.
source share