What's the purpose of NSCache's name? The Apple docs only say that you can set/retrieve the name of the cache using this property. So, what is it used for?
As far as I can tell, Foundation doesn't use it for anything—not even for the cache's description
, which seems like a missed opportunity to me.
You can retrieve a cache's name
yourself, but I can't think of a reason why you would be passing caches around within your application and might therefore not already know which one you're looking at.
So the answer, as of Lion, seems to be: Nothing.
The singular usage seems to be differentiation of caches when cache:willEvictObject:
gets called in the NSCacheDelegate
. This way you could (for instance) have a single object handling logging of cache expirations for all of your NSCache
s and still have useful log messages that told where the objects were being evicted from.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With