Skip to content

Commit

Permalink
Merge 3bb42ae into e6b139d
Browse files Browse the repository at this point in the history
  • Loading branch information
x0ji0d committed Feb 11, 2020
2 parents e6b139d + 3bb42ae commit 7d78849
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/scala/com/evolutiongaming/scache/Cache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ trait Cache[F[_], K, V] {

def get(key: K): F[Option[V]]

def getOrElse(key: K, default: => F[V])(implicit F: Monad[F]): F[V] = get(key).flatMap(_.fold(default)(_.pure[F]))

/**
* Does not run `value` concurrently for the same key
*/
Expand Down
4 changes: 3 additions & 1 deletion src/main/scala/com/evolutiongaming/scache/SerialMap.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.evolutiongaming.scache

import cats.Applicative
import cats.{Applicative, Monad}
import cats.effect.Concurrent
import cats.effect.concurrent.Ref
import cats.effect.implicits._
Expand All @@ -15,6 +15,8 @@ trait SerialMap[F[_], K, V] {

def get(key: K): F[Option[V]]

def getOrElse(key: K, default: => F[V])(implicit F: Monad[F]): F[V] = get(key).flatMap(_.fold(default)(_.pure[F]))

def put(key: K, value: V): F[Option[V]]

/**
Expand Down

0 comments on commit 7d78849

Please sign in to comment.