FileSystemCache

constructor(directory: File, encode: (V) -> String, decode: (String) -> V, ioContext: CoroutineContext = Dispatchers.IO, currentTimeMillis: () -> Long = System::currentTimeMillis, maxSizeBytes: Long? = DEFAULT_MAX_SIZE_BYTES)

Parameters

directory

the storage directory; created on first write.

encode

serializes a value to text.

decode

parses text produced by encode back into a value.

ioContext

context for blocking file I/O; defaults to Dispatchers.IO.

currentTimeMillis

time source, injectable for deterministic tests.

maxSizeBytes

maximum disk usage in bytes for owned cache files. Defaults to 50 MB. Pass null for unbounded (not recommended for production).