SDImageCache Class Reference
| Inherits from | NSObject |
| Declared in | SDImageCache.h |
Overview
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.
Tasks
-
maxCacheAgeThe maximum length of time to keep an image in the cache, in seconds
property -
+ sharedImageCacheReturns global shared cache instance
-
– initWithNamespace:Init a new cache store with a specific namespace
-
– storeImage:forKey:Store an image into memory and disk cache at the given key.
-
– storeImage:forKey:toDisk:Store an image into memory and optionally disk cache at the given key.
-
– storeImage:imageData:forKey:toDisk:Store an image into memory and optionally disk cache at the given key.
-
– queryDiskCacheForKey:done:Query the disk cache asynchronousely.
-
– imageFromMemoryCacheForKey:Query the memory cache.
-
– imageFromDiskCacheForKey:Query the disk cache synchronousely.
-
– removeImageForKey:Remove the image from memory and disk cache synchronousely
-
– removeImageForKey:fromDisk:Remove the image from memory and optionaly disk cache synchronousely
-
– clearMemoryClear all memory cached images
-
– clearDiskClear all disk cached images
-
– cleanDiskRemove all expired cached image from disk
-
– getSizeGet the size used by the disk cache
-
– getDiskCountGet the number of images in the disk cache
Instance Methods
cleanDisk
Remove all expired cached image from disk
- (void)cleanDiskDiscussion
Remove all expired cached image from disk
Declared In
SDImageCache.hclearDisk
Clear all disk cached images
- (void)clearDiskDiscussion
Clear all disk cached images
Declared In
SDImageCache.hclearMemory
Clear all memory cached images
- (void)clearMemoryDiscussion
Clear all memory cached images
Declared In
SDImageCache.hgetDiskCount
Get the number of images in the disk cache
- (int)getDiskCountDiscussion
Get the number of images in the disk cache
Declared In
SDImageCache.hgetSize
Get the size used by the disk cache
- (int)getSizeDiscussion
Get the size used by the disk cache
Declared In
SDImageCache.himageFromDiskCacheForKey:
Query the disk cache synchronousely.
- (UIImage *)imageFromDiskCacheForKey:(NSString *)keyParameters
- key
The unique key used to store the wanted image
Discussion
Query the disk cache synchronousely.
Declared In
SDImageCache.himageFromMemoryCacheForKey:
Query the memory cache.
- (UIImage *)imageFromMemoryCacheForKey:(NSString *)keyParameters
- key
The unique key used to store the wanted image
Discussion
Query the memory cache.
Declared In
SDImageCache.hinitWithNamespace:
Init a new cache store with a specific namespace
- (id)initWithNamespace:(NSString *)nsParameters
- ns
The namespace to use for this cache store
Discussion
Init a new cache store with a specific namespace
Declared In
SDImageCache.hqueryDiskCacheForKey:done:
Query the disk cache asynchronousely.
- (void)queryDiskCacheForKey:(NSString *)key done:(void ( ^ ) ( UIImage *image , SDImageCacheType cacheType ))doneBlockParameters
- key
The unique key used to store the wanted image
Discussion
Query the disk cache asynchronousely.
Declared In
SDImageCache.hremoveImageForKey:
Remove the image from memory and disk cache synchronousely
- (void)removeImageForKey:(NSString *)keyParameters
- key
The unique image cache key
Discussion
Remove the image from memory and disk cache synchronousely
Declared In
SDImageCache.hremoveImageForKey:fromDisk:
Remove the image from memory and optionaly disk cache synchronousely
- (void)removeImageForKey:(NSString *)key fromDisk:(BOOL)fromDiskParameters
- key
The unique image cache key
- fromDisk
Also remove cache entry from disk if YES
Discussion
Remove the image from memory and optionaly disk cache synchronousely
Declared In
SDImageCache.hstoreImage:forKey:
Store an image into memory and disk cache at the given key.
- (void)storeImage:(UIImage *)image forKey:(NSString *)keyParameters
- image
The image to store
- key
The unique image cache key, usually it’s image absolute URL
Discussion
Store an image into memory and disk cache at the given key.
Declared In
SDImageCache.hstoreImage:forKey:toDisk:
Store an image into memory and optionally disk cache at the given key.
- (void)storeImage:(UIImage *)image forKey:(NSString *)key toDisk:(BOOL)toDiskParameters
- image
The image to store
- key
The unique image cache key, usually it’s image absolute URL
- toDisk
Store the image to disk cache if YES
Discussion
Store an image into memory and optionally disk cache at the given key.
Declared In
SDImageCache.hstoreImage:imageData:forKey:toDisk:
Store an image into memory and optionally disk cache at the given key.
- (void)storeImage:(UIImage *)image imageData:(NSData *)data forKey:(NSString *)key toDisk:(BOOL)toDiskParameters
- image
The image to store
- data
The image data as returned by the server, this representation will be used for disk storage instead of converting the given image object into a storable/compressed image format in order to save quality and CPU
- key
The unique image cache key, usually it’s image absolute URL
- toDisk
Store the image to disk cache if YES
Discussion
Store an image into memory and optionally disk cache at the given key.
Declared In
SDImageCache.h