Mac Developer Library

Developer

Foundation Framework Reference NSCacheDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSCacheDelegate

The delegate of an NSCache object implements this protocol to perform specialized actions when an object is about to be evicted or removed from the cache.

Inheritance


Not Applicable

Import Statement


import Foundation @import Foundation;

Availability


Available in OS X v10.6 and later.
  • Called when an object is about to be evicted or removed from the cache.

    Declaration

    Swift

    optional func cache(_ cache: NSCache, willEvictObject obj: AnyObject)

    Objective-C

    - (void)cache:(NSCache *)cache willEvictObject:(id)obj

    Parameters

    cache

    The cache with which the object of interest is associated.

    obj

    The object of interest in the cache.

    Discussion

    It is not possible to modify cache from within the implementation of this delegate method.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.6 and later.