轻量级的零设置 iOS 图像缓存器:Haneke

jopen 10年前

Haneke 是个轻量级的零设置 iOS 图像缓存器。Haneke 可以调整图像和内存以及硬盘的缓存大小。所有的步骤都在后台进行,允许快速响应滚动。

特性:

  • First-level memory cache using NSCache.
  • Second-level LRU disk cache using the file system.
  • Zero-config UIImageView category to use the cache, optimized for UITableView and UICollectionView cell reuse.
  • Asynchronous and synchronous image retrieval.
  • Background image resizing and file reading.
  • Custom image transformations before and after resizing.
  • Thread-safe.
  • Automatic cache eviction on memory warnings or disk capacity reached.
  • Preloading images from the disk cache into memory on startup.

HNKCacheFormat *format = [[HNKCacheFormat alloc] initWithName:@"thumbnail"];  format.size = CGSizeMake(320, 240);  format.scaleMode = HNKScaleModeAspectFill;  format.compressionQuality = 0.5;  format.diskCapacity = 1 * 1024 * 1024; // 1MB  format.preloadPolicy = HNKPreloadPolicyLastSession;  imageView.hnk_cacheFormat = format;

项目主页:http://www.open-open.com/lib/view/home/1394522230692