forked from shihaam/thijooree
add clear cache
This commit is contained in:
@@ -26,6 +26,11 @@ object TransactionCache {
|
||||
} catch (_: Exception) {}
|
||||
}
|
||||
|
||||
fun clearAll(context: Context) {
|
||||
context.cacheDir.listFiles { f -> f.name.startsWith("tx_") && f.name.endsWith(".json") }
|
||||
?.forEach { it.delete() }
|
||||
}
|
||||
|
||||
fun load(context: Context, key: String): List<Transaction> = try {
|
||||
val arr = JSONArray(File(context.cacheDir, "tx_$key.json").readText())
|
||||
(0 until arr.length()).map { i ->
|
||||
|
||||
Reference in New Issue
Block a user