Search in sources :

Example 1 with LruDiskCache

use of com.nostra13.universalimageloader.cache.disc.impl.ext.LruDiskCache in project Android-Universal-Image-Loader by nostra13.

the class DefaultConfigurationFactory method createDiskCache.

/**
	 * Creates default implementation of {@link DiskCache} depends on incoming parameters
	 */
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator, long diskCacheSize, int diskCacheFileCount) {
    File reserveCacheDir = createReserveDiskCacheDir(context);
    if (diskCacheSize > 0 || diskCacheFileCount > 0) {
        File individualCacheDir = StorageUtils.getIndividualCacheDirectory(context);
        try {
            return new LruDiskCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize, diskCacheFileCount);
        } catch (IOException e) {
            L.e(e);
        // continue and create unlimited cache
        }
    }
    File cacheDir = StorageUtils.getCacheDirectory(context);
    return new UnlimitedDiskCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator);
}
Also used : UnlimitedDiskCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache) LruDiskCache(com.nostra13.universalimageloader.cache.disc.impl.ext.LruDiskCache) IOException(java.io.IOException) File(java.io.File)

Aggregations

UnlimitedDiskCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache)1 LruDiskCache (com.nostra13.universalimageloader.cache.disc.impl.ext.LruDiskCache)1 File (java.io.File)1 IOException (java.io.IOException)1