Is there a way to inspect NSCache's contents for debugging purposes?
This would not be used in the App Store. I just would like to be able to see what's going on in there while debugging. The description
is pretty useless.
Is there a way to inspect NSCache's contents for debugging purposes?
This would not be used in the App Store. I just would like to be able to see what's going on in there while debugging. The description
is pretty useless.
There is an open-source replacement for NSCache that solves this exact issue: https://github.com/gregkrsak/GKCache
No need to use a third party library. You can do this using the "allObjects" key from NSCache. For example:
if let all = yourCache.value(forKey: "allObjects") as? NSArray {
for object in all {
print("object is \(object)")
}
}
There is an open-source replacement for NSCache that solves this exact issue: https://github.com/gregkrsak/GKCache
NSCache doesn't have such feature. But you can use custom solution, e.g.: VSCache
It's thread-safe and easy to use.
You can see all keys and objects with
-[NSCache mapTableRepresentation]
© 2022 - 2024 — McMap. All rights reserved.