![License: MIT](https://camo.githubusercontent.com/54da2b844cd6a7d7a67833964ffaad9ea8a8098dfe1c3fdea6bdce144d792759/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f77677265656e2e737667)
- Auto loading of missing values
- Expiry of not used records
- Deleting oldest values in case of exceeding max size
- Tagless Final
- Partition entries by
hashCode
into multiple caches in order to avoid thread contention for some corner cases
trait Cache[F[_], K, V] {
def get(key: K): F[Option[V]]
/**
* Does not run `value` concurrently for the same key
*/
def getOrUpdate(key: K)(value: => F[V]): F[V]
/**
* @return previous value if any, possibly not yet loaded
*/
def put(key: K, value: V): F[Option[F[V]]]
def keys: F[Set[K]]
/**
* Might be an expensive call
*/
def values: F[Map[K, F[V]]]
/**
* @return previous value if any, possibly not yet loaded
*/
def remove(key: K): F[Option[F[V]]]
/**
* Removes loading values from the cache, however does not cancel them
*/
def clear: F[Unit]
}
resolvers += Resolver.bintrayRepo("evolutiongaming", "maven")
libraryDependencies += "com.evolutiongaming" %% "scache" % "0.0.1"