All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.mokkery.plugin.core.Cache.kt Maven / Gradle / Ivy

Go to download

Mokkery is a mocking library for Kotlin Multiplatform, easy to use, boilerplate-free and compiler plugin driven.

The newest version!
package dev.mokkery.plugin.core

interface Cache {

    fun getOrPut(key: K, block: () -> V): V

    fun clear()
}

fun  Cache(): Cache = HashMapCache()

private class HashMapCache : Cache {

    private val map = mutableMapOf()
    override fun getOrPut(key: K, block: () -> V): V = map.getOrPut(key, block)

    override fun clear() = map.clear()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy