Avatar
@swift-6.0.3 import Foundation let cache = NSCache<NSNumber, NSNumber>() cache.countLimit = 2 cache.setObject(1, forKey: 1) cache.setObject(2, forKey: 2) cache.setObject(3, forKey: 3) print(cache.object(forKey: 1)) print(cache.object(forKey: 2)) print(cache.object(forKey: 3))