NSCache Name Property

What is the purpose of the NSCache name? Apple docs only say that you can set / get the cache name using this property. So what is it used for?

+6
source share
2 answers

As far as I can tell, Foundation doesn't use it for anything - not even for the description cache, which seems like a missed opportunity to me.

You can get the name cache yourself, but I can’t think of the reason why you will transfer caches inside your application and, therefore, you may not know which one you are looking at.

So, the answer, like that of Leo, seems: Nothing.

+5
source

The only use seems to be cache:willEvictObject: differentiation when cache:willEvictObject: is called in NSCacheDelegate . That way, you can (for example) have one object that handles logging of cache exits for all of your NSCache and still have useful log messages that indicate where the objects came from.

+4
source

Source: https://habr.com/ru/post/909381/


All Articles