INNER CODE UNIT · Kotlin

setLastCacheTime

bufferapp/android-clean-architecture-boilerplate · cache/src/main/java/org/buffer/android/boilerplate/cache/BufferooCacheImpl.kt:107

    override fun setLastCacheTime(lastCache: Long) {
        preferencesHelper.lastCacheTime = lastCache
    }

    /**
     * Check whether the current cached data exceeds the defined [EXPIRATION_TIME] time
     */
    override fun isExpired(): Boolean {
        val currentTime = System.currentTimeMillis()
        val lastUpdateTime = this.getLastCacheUpdateTimeMillis()
        return currentTime - lastUpdateTime > EXPIRATION_TIME
    }

    /**
     * Get in millis, the last time the cache was accessed.
     */
    private fun getLastCacheUpdateTimeMillis(): Long {
        return preferencesHelper.lastCacheTime

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…