DTDownloadCache Class Reference
| Inherits from | NSObject |
| Conforms to | DTDownloadDelegate |
| Declared in | DTDownloadCache.h |
Overview
A global cache for DTDownload instances.
Note: all URL parameters may only be remote URLs e.g. http: or https.
Specialized methods for dealing with images. An NSCache holds on to UIImage references after they have been retrieved once since that speeds up subsequent drawing.
Tasks
Accessing the Shared Instance
Downloading Data
-
– cachedDataForURL:option: -
– cachedDataForURL:option:priority: -
– cachedDataForURL:option:completion: -
– cachedDataForURL:option:priority:completion:
Retrieving Information about the Cache
-
– currentDiskUsage -
maxNumberOfConcurrentDownloadsproperty -
diskCapacityproperty -
loadLastAddedURLFirstproperty
Images Methods
Properties
diskCapacity
The maximum disk space used for caching files. The default value is 20 MB.
@property (nonatomic, assign) NSUInteger diskCapacityDeclared In
DTDownloadCache.hInstance Methods
cachedDataForURL:option:
The URL of the file
- (NSData *)cachedDataForURL:(NSURL *)URL option:(DTDownloadCacheOption)optionParameters
- URL
The URL of the file
- option
A loading option to specify wheter the file should be loaded if it is already cached.
Return Value
The cached image or nil if none is cached.
Declared In
DTDownloadCache.hcachedDataForURL:option:completion:
The URL of the file
- (NSData *)cachedDataForURL:(NSURL *)URL option:(DTDownloadCacheOption)option completion:(DTDownloadCacheDataCompletionBlock)completionParameters
- URL
The URL of the file
- option
A loading option to specify wheter the file should be loaded if it is already cached.
- completion
The block to be executed when the file data is available.
Return Value
The cached data or nil if none is cached.
Declared In
DTDownloadCache.hcachedDataForURL:option:priority:
The URL of the file
- (NSData *)cachedDataForURL:(NSURL *)URL option:(DTDownloadCacheOption)option priority:(DTDownloadCachePriority)priorityParameters
- URL
The URL of the file
- option
A loading option to specify wheter the file should be loaded if it is already cached.
- priority
The priority when a download is handled
Return Value
The cached image or nil if none is cached.
Declared In
DTDownloadCache.hcachedDataForURL:option:priority:completion:
The URL of the file
- (NSData *)cachedDataForURL:(NSURL *)URL option:(DTDownloadCacheOption)option priority:(DTDownloadCachePriority)priority completion:(DTDownloadCacheDataCompletionBlock)completionParameters
- URL
The URL of the file
- option
A loading option to specify wheter the file should be loaded if it is already cached.
- priority
priority
- completion
The block to be executed when the file data is available.
Return Value
The cached data or nil if none is cached.
Declared In
DTDownloadCache.hcachedImageForURL:option:
Specialized method for retrieving cached images.
- (UIImage *)cachedImageForURL:(NSURL *)URL option:(DTDownloadCacheOption)optionParameters
- URL
The URL of the image
- option
A loading option to specify wheter the file should be loaded if it is already cached.
Return Value
The cached image or nil if none is cached.
Declared In
DTDownloadCache.hcachedImageForURL:option:completion:
Provides the cached or downloaded image.
- (UIImage *)cachedImageForURL:(NSURL *)URL option:(DTDownloadCacheOption)option completion:(DTDownloadCacheImageCompletionBlock)completionParameters
- URL
The URL of the image
- option
A loading option to specify wheter the file should be loaded if it is already cached.
- completion
The block to be executed when the image is available.
Return Value
The cached image or nil if none is cached.
Discussion
If the image is already cached it will be returned and the block not be executed. If it needs to be loaded then nil is returned and the block gets executed as soon as the image has been downloaded.
Declared In
DTDownloadCache.hcachedImageForURL:option:priority:
Specialized method for retrieving cached images.
- (UIImage *)cachedImageForURL:(NSURL *)URL option:(DTDownloadCacheOption)option priority:(DTDownloadCachePriority)priorityParameters
- URL
The URL of the image
- option
A loading option to specify wheter the file should be loaded if it is already cached.
- priority
The priority when a download is handled
Return Value
The cached image or nil if none is cached.
Declared In
DTDownloadCache.hcachedImageForURL:option:priority:completion:
Provides the cached or downloaded image.
- (UIImage *)cachedImageForURL:(NSURL *)URL option:(DTDownloadCacheOption)option priority:(DTDownloadCachePriority)priority completion:(DTDownloadCacheImageCompletionBlock)completionParameters
- URL
The URL of the image
- option
A loading option to specify wheter the file should be loaded if it is already cached.
- priority
The priority when a download is handled
- completion
The block to be executed when the image is available.
Return Value
The cached image or nil if none is cached.
Discussion
If the image is already cached it will be returned and the block not be executed. If it needs to be loaded then nil is returned and the block gets executed as soon as the image has been downloaded.
Declared In
DTDownloadCache.h