package xyz.cottongin.radio247.metadata

class ArtCache(private val maxSize: Int = 500) {
    private val cache = object : LinkedHashMap<String, String>(maxSize, 0.75f, true) {
        override fun removeEldestEntry(eldest: MutableMap.MutableEntry<String, String>?): Boolean {
            return size > maxSize
        }
    }

    @Synchronized
    fun get(key: String): String? = cache[key]

    @Synchronized
    fun put(key: String, url: String) {
        cache[key] = url
    }
}
