arch-android

//Android/br.com.arch.toolkit.android.util/ThresholdData

ThresholdData

[android]
class ThresholdData<T>(duration: Duration)

Keeps a single value in memory and automatically invalidates it after duration.

The cache entry is scoped by both storageName and name. A get call with a different scope clears the entry and returns null.

This utility is platform-agnostic and can be reused from KMP shared logic.

Constructors

   
ThresholdData [android]
constructor(duration: Duration)

Functions

Name Summary
clear [android]
fun clear()
Clears all cached metadata and value.
get [android]
fun get(storageName: String, name: String): T?
Returns the cached value for the informed scope.
isExpired [android]
fun isExpired(): Boolean
Returns true when the cached value is missing or older than duration.
set [android]
fun set(storageName: String, name: String, data: T?)
Replaces the current entry.