|
|
@@ -57,7 +57,7 @@ Note: neither your success nor failure block will be call if your image request
|
|
|
|
|
|
The `SDWebImageManager` is the class behind the `UIImageView(WebCache)` category. It ties the asynchronous downloader with the image cache store. You can use this class directly to benefit from web image downloading with caching in another context than a `UIView` (ie: with Cocoa).
|
|
|
|
|
|
-Note: When the image is from memory cache, it will not contains any `NSData` by default. However, if you need image data, you can pass `SDWebImageQueryDataWhenInMemory` in options arg.
|
|
|
+Note: When the image is from memory cache, it will not contain any `NSData` by default. However, if you need image data, you can pass `SDWebImageQueryDataWhenInMemory` in options arg.
|
|
|
|
|
|
Here is a simple example of how to use `SDWebImageManager`:
|
|
|
|
|
|
@@ -95,11 +95,11 @@ SDWebImageDownloader *downloader = [SDWebImageDownloader sharedDownloader];
|
|
|
|
|
|
### Using Asynchronous Image Caching Independently
|
|
|
|
|
|
-It is also possible to use the async based image cache store independently. SDImageCache
|
|
|
+It is also possible to use the async based image cache store independently. `SDImageCache`
|
|
|
maintains a memory cache and an optional disk cache. Disk cache write operations are performed
|
|
|
asynchronous so it doesn't add unnecessary latency to the UI.
|
|
|
|
|
|
-The SDImageCache class provides a singleton instance for convenience but you can create your own
|
|
|
+The `SDImageCache` class provides a singleton instance for convenience but you can create your own
|
|
|
instance if you want to create separated cache namespace.
|
|
|
|
|
|
To lookup the cache, you use the `queryDiskCacheForKey:done:` method. If the method returns nil, it means the cache
|
|
|
@@ -114,10 +114,10 @@ SDImageCache *imageCache = [[SDImageCache alloc] initWithNamespace:@"myNamespace
|
|
|
}];
|
|
|
```
|
|
|
|
|
|
-By default SDImageCache will lookup the disk cache if an image can't be found in the memory cache.
|
|
|
+By default `SDImageCache` will lookup the disk cache if an image can't be found in the memory cache.
|
|
|
You can prevent this from happening by calling the alternative method `imageFromMemoryCacheForKey:`.
|
|
|
|
|
|
-To store an image into the cache, you use the storeImage:forKey:completion: method:
|
|
|
+To store an image into the cache, you use the `storeImage:forKey:completion:` method:
|
|
|
|
|
|
```objective-c
|
|
|
[[SDImageCache sharedImageCache] storeImage:myImage forKey:myCacheKey completion:^{
|
|
|
@@ -126,14 +126,14 @@ To store an image into the cache, you use the storeImage:forKey:completion: meth
|
|
|
```
|
|
|
|
|
|
By default, the image will be stored in memory cache as well as on disk cache (asynchronously). If
|
|
|
-you want only the memory cache, use the alternative method storeImage:forKey:toDisk:completion: with a negative
|
|
|
+you want only the memory cache, use the alternative method `storeImage:forKey:toDisk:completion:` with a negative
|
|
|
third argument.
|
|
|
|
|
|
### Using cache key filter
|
|
|
|
|
|
Sometime, you may not want to use the image URL as cache key because part of the URL is dynamic
|
|
|
-(i.e.: for access control purpose). SDWebImageManager provides a way to set a cache key filter that
|
|
|
-takes the NSURL as input, and output a cache key NSString.
|
|
|
+(i.e.: for access control purpose). `SDWebImageManager` provides a way to set a cache key filter that
|
|
|
+takes the `NSURL` as input, and output a cache key `NSString`.
|
|
|
|
|
|
The following example sets a filter in the application delegate that will remove any query-string from
|
|
|
the URL before to use it as a cache key:
|