let cache = Cache<JSON>("movies")
let URL = NSURL(string: "http://haneke.io/movies.json")
cache.fetch(URL: URL).onSuccess { JSON in
// Do something with JSON
}
特性
Generic cache with out-of-the-box support for UIImage, NSData, JSON and String
First-level memory cache using NSCache
Second-level LRU disk cache using the file system
Asynchronous fetching of original values from network or disk
All disk access is performed in background
Thread-safe
Automatic cache eviction on memory warnings or disk capacity reached
Comprehensive unit tests
Extensible by defining custom formats, supporting additional types or implementing custom fetchers