add clear cache

This commit is contained in:
2026-05-15 12:00:59 +05:00
parent 7c0ffece35
commit e8469a8888
11 changed files with 72 additions and 0 deletions
@@ -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 ->