trim

abstract suspend fun trim(maxSizeBytes: Long, trimFactor: Float = 0.1f): Long

Trims the store if its size exceeds maxSizeBytes. The amount of data to remove is determined by trimFactor. The oldest records are removed according to their updated date.

This may not be supported by all cache implementations (currently this is implemented by the SQL cache).

Return

the cache size in bytes after trimming or -1 if the operation is not supported.

Parameters

maxSizeBytes

the size of the cache in bytes above which the cache should be trimmed.

trimFactor

the factor of the cache size to trim.