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

com.wavesenterprise.utils.Caches.scala Maven / Gradle / Ivy

There is a newer version: 1.16.0
Show newest version
package com.wavesenterprise.utils

import com.google.common.cache.{CacheBuilder, CacheLoader, LoadingCache}

object Caches {
  def cache[K <: AnyRef, V <: AnyRef](maximumSize: Int, loader: K => V): LoadingCache[K, V] =
    CacheBuilder
      .newBuilder()
      .maximumSize(maximumSize)
      .build(new CacheLoader[K, V] {
        override def load(key: K) = loader(key)
      })
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy