INNER CODE UNIT · Kotlin
loadCacheIfValid
NexAlloy/NexAlloy · app/src/main/java/io/github/nexalloy/PatchExecutor.kt:190
private fun loadCacheIfValid() {
// cache by host update time + module version
// also no cache if is DEBUG
val packageInfo = appContext.packageManager.getPackageInfo(appContext.packageName, 0)
val id = "${packageInfo.lastUpdateTime}-$moduleRel"
val cachedId = cache.getString("id", null)
val isCached = cachedId.equals(id) && !DEBUG
Logger.printInfo { "cache ID : $id" }
Logger.printInfo { "cached ID: ${cachedId ?: ""}" }
Logger.printInfo { "Using cached keys: $isCached" }
if (!isCached) {
cache.clearAll()
cache.putString("id", id)
Utils.showToastLong("NexAlloy is initializing, please wait...")
}