ModelCache

open class ModelCache<A, B>

A simple cache that can be used by ModelLoader and ModelLoaderFactory to cache some data for a given model, width and height. For a loader that takes a model and returns a url, the cache could be used to safely memoize url creation based on the width and height of the view.

Parameters

<A>

Some Model type that implements equals and hashCode.

<B>

Some useful type that may be expensive to create (URL, file path, etc).

Constructors

Link copied to clipboard
open fun ModelCache()
Link copied to clipboard
open fun ModelCache(size: Long)

Functions

Link copied to clipboard
open fun clear()
Removes all entries from the cache.
Link copied to clipboard
open fun get(    model: A,     width: Int,     height: Int): B
Get a value.
Link copied to clipboard
open fun put(    model: A,     width: Int,     height: Int,     value: B)
Add a value.