java.lang.Object | |
↳ | com.droidux.pack.gallery.cache.GalleryUrlImageCache.Default |
Default implementation of the UrlImageCache. This cache implements 2-level mechanism (memory and disk backstore) to hold the images. The disk cache is using the Android cache directory to store the images.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Clear the cache.
| |||||||||||
Clears the disk cache.
| |||||||||||
Clears the memory cache.
| |||||||||||
Gets the bitmap for the specified url from the cache.
| |||||||||||
For efficiency, if the requested Bitmap is available for quick fetch, for example from memory cache, it will be returned here.
| |||||||||||
Store the bitmap for the specified url in the cache.
| |||||||||||
Sets the cache directory.
| |||||||||||
Sets the lifetime of the disk cache.
| |||||||||||
Sets the maximum capacity of the memory cache.
| |||||||||||
Sets the Time-to-live of the memory cache.
| |||||||||||
Sets whether to use the disk cache.
| |||||||||||
Sets whether the memory cache be used.
| |||||||||||
Check whether we are using the disk cache.
| |||||||||||
Check whether we are using the memory cache.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.droidux.pack.gallery.cache.GalleryUrlImageCache
|
Gets the bitmap for the specified url from the cache.
Use getFast(String)
first to see whether the image is readily available for quick fetch.
The getFast(String)
is called in the UI thread, whereas this function is called in the background thread.
url | The image url. |
---|
For efficiency, if the requested Bitmap is available for quick fetch, for example from memory cache, it will be returned here.
This function will be called in the UI thread.
The get(String)
function will be called in the background thread to allow for longer fetch, for example from 2nd level/disk cache.
url | The image url. |
---|
Store the bitmap for the specified url in the cache.
url | The image url. |
---|---|
bitmap | The web image. |
Sets the cache directory.
cacheDir | The cache directory. Default is set to the Android default cache directory. |
---|
Sets the lifetime of the disk cache.
lifetime | The lifetime in seconds. Default is 86400 seconds (24 hrs). |
---|
Sets the maximum capacity of the memory cache. If the cache is filled with more than the specified capacity, the eldest entry will be remove from the memory, and stored to disk (if the disk cache is enabled).
capacity | The maximum capacity. Default is 50. |
---|
Sets the Time-to-live of the memory cache.
ttl | Time-to-live in seconds. Default is 180 seconds (3 minutes). |
---|
Sets whether to use the disk cache.
use | If true, the disk cache will be used. Default is true. |
---|
Sets whether the memory cache be used.
use | If true, the memory cache will be used. Default is true. |
---|
Check whether we are using the disk cache.
Check whether we are using the memory cache.