单例

static ImageCache *sharedCacheInstance =nil;

+ (ImageCache *)sharedCache

{

    @synchronized(self) {

        static dispatch_once_t predicate;

        dispatch_once(&predicate, ^{

            sharedCacheInstance = [[selfalloc] init];

        });

    }

    returnsharedCacheInstance;

}


你可能感兴趣的:(单例)