|
|
@ -769,31 +769,27 @@ class ACache private constructor(cacheDir: File, max_size: Long, max_count: Int) |
|
|
|
private val mInstanceMap = HashMap<String, ACache>() |
|
|
|
private val mInstanceMap = HashMap<String, ACache>() |
|
|
|
|
|
|
|
|
|
|
|
@JvmOverloads |
|
|
|
@JvmOverloads |
|
|
|
operator fun get(ctx: Context, cacheName: String = "ACache"): ACache? { |
|
|
|
fun get( |
|
|
|
val f = File(ctx.cacheDir, cacheName) |
|
|
|
ctx: Context, |
|
|
|
return get(f, MAX_SIZE.toLong(), MAX_COUNT) |
|
|
|
cacheName: String = "ACache", |
|
|
|
} |
|
|
|
maxSize: Long = MAX_SIZE.toLong(), |
|
|
|
|
|
|
|
maxCount: Int = MAX_COUNT, |
|
|
|
operator fun get(ctx: Context, max_zise: Long, max_count: Int): ACache? { |
|
|
|
cacheDir: Boolean = true |
|
|
|
try { |
|
|
|
): ACache? { |
|
|
|
val f = File(ctx.cacheDir, "ACache") |
|
|
|
val f = if (cacheDir) File(ctx.cacheDir, cacheName) else File(ctx.filesDir, cacheName) |
|
|
|
return get(f, max_zise, max_count) |
|
|
|
return get(f, maxSize, maxCount) |
|
|
|
} catch (ignored: Exception) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@JvmOverloads |
|
|
|
@JvmOverloads |
|
|
|
operator fun get( |
|
|
|
fun get( |
|
|
|
cacheDir: File, |
|
|
|
cacheDir: File, |
|
|
|
max_zise: Long = MAX_SIZE.toLong(), |
|
|
|
maxSize: Long = MAX_SIZE.toLong(), |
|
|
|
max_count: Int = MAX_COUNT |
|
|
|
maxCount: Int = MAX_COUNT |
|
|
|
): ACache? { |
|
|
|
): ACache? { |
|
|
|
try { |
|
|
|
try { |
|
|
|
var manager = mInstanceMap[cacheDir.absoluteFile.toString() + myPid()] |
|
|
|
var manager = mInstanceMap[cacheDir.absoluteFile.toString() + myPid()] |
|
|
|
if (manager == null) { |
|
|
|
if (manager == null) { |
|
|
|
manager = ACache(cacheDir, max_zise, max_count) |
|
|
|
manager = ACache(cacheDir, maxSize, maxCount) |
|
|
|
mInstanceMap[cacheDir.absolutePath + myPid()] = manager |
|
|
|
mInstanceMap[cacheDir.absolutePath + myPid()] = manager |
|
|
|
} |
|
|
|
} |
|
|
|
return manager |
|
|
|
return manager |
|
|
|