/* NSCache.h Copyright (c) 2008-2019, Apple Inc. All rights reserved. */ #import @class NSString; @protocol NSCacheDelegate; NS_HEADER_AUDIT_BEGIN(nullability, sendability) API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) @interface NSCache : NSObject @property (copy) NSString *name; @property (nullable, assign) id delegate; - (nullable ObjectType)objectForKey:(KeyType)key; - (void)setObject:(ObjectType)obj forKey:(KeyType)key; // 0 cost - (void)setObject:(ObjectType)obj forKey:(KeyType)key cost:(NSUInteger)g; - (void)removeObjectForKey:(KeyType)key; - (void)removeAllObjects; @property NSUInteger totalCostLimit; // limits are imprecise/not strict @property NSUInteger countLimit; // limits are imprecise/not strict @property BOOL evictsObjectsWithDiscardedContent; @end @protocol NSCacheDelegate @optional - (void)cache:(NSCache *)cache willEvictObject:(id)obj; @end NS_HEADER_AUDIT_END(nullability, sendability)