Skip to content

Instantly share code, notes, and snippets.

@itasyurt
Created April 11, 2020 17:50
Show Gist options
  • Save itasyurt/02d61d3c29a172c005155bfab4a20e8e to your computer and use it in GitHub Desktop.
Save itasyurt/02d61d3c29a172c005155bfab4a20e8e to your computer and use it in GitHub Desktop.
class ListCacheManager : AbstractCacheManager() {
var caches = mutableListOf<Cache>()
var cacheMap = mutableMapOf<String, Cache>()
override fun loadCaches() = caches
override fun getCache(name: String): Cache {
if (name in cacheMap) {
return cacheMap[name]!!
} else {
return ListCache(name).also {
cacheMap[name] = it
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment