From 04f882be1672c9c6bbacf55a8808165b053aab49 Mon Sep 17 00:00:00 2001 From: Kyri Petrou Date: Fri, 5 Jul 2024 17:04:25 +1000 Subject: [PATCH] Rename once more --- zio-query/shared/src/main/scala/zio/query/Cache.scala | 4 ++-- zio-query/shared/src/main/scala/zio/query/ZQuery.scala | 4 ++-- .../src/main/scala/zio/query/internal/BlockedRequests.scala | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/zio-query/shared/src/main/scala/zio/query/Cache.scala b/zio-query/shared/src/main/scala/zio/query/Cache.scala index 1a64d92..b2387c8 100644 --- a/zio-query/shared/src/main/scala/zio/query/Cache.scala +++ b/zio-query/shared/src/main/scala/zio/query/Cache.scala @@ -79,7 +79,7 @@ object Cache { * value. Prefer extending this class when implementing a cache that doesn't * perform any IO, such as a cache based on a Map. */ - abstract class InMemory extends Cache { + abstract class InMemoryCache extends Cache { def getNow[E, A](request: Request[E, A]): Option[Promise[E, A]] def lookupNow[E, A](request: Request[E, A]): Either[Promise[E, A], Promise[E, A]] def putNow[E, A](request: Request[E, A], result: Promise[E, A]): Unit @@ -105,7 +105,7 @@ object Cache { ZIO.succeed(removeNow(request)) } - private final class NonExpiringCache(map: ConcurrentHashMap[Request[_, _], Promise[_, _]]) extends InMemory { + private final class NonExpiringCache(map: ConcurrentHashMap[Request[_, _], Promise[_, _]]) extends InMemoryCache { private implicit val unsafe: Unsafe = Unsafe.unsafe def getNow[E, A](request: Request[E, A]): Option[Promise[E, A]] = diff --git a/zio-query/shared/src/main/scala/zio/query/ZQuery.scala b/zio-query/shared/src/main/scala/zio/query/ZQuery.scala index 458686b..b72ddb1 100644 --- a/zio-query/shared/src/main/scala/zio/query/ZQuery.scala +++ b/zio-query/shared/src/main/scala/zio/query/ZQuery.scala @@ -1559,8 +1559,8 @@ object ZQuery { } cache match { - case cache: Cache.InMemory => foldPromise(cache.lookupNow(request)) - case cache => CachedResult.Effectful(cache.lookup(request).flatMap(foldPromise(_).toZIO)) + case cache: Cache.InMemoryCache => foldPromise(cache.lookupNow(request)) + case cache => CachedResult.Effectful(cache.lookup(request).flatMap(foldPromise(_).toZIO)) } } diff --git a/zio-query/shared/src/main/scala/zio/query/internal/BlockedRequests.scala b/zio-query/shared/src/main/scala/zio/query/internal/BlockedRequests.scala index 9812dbc..d7475c3 100644 --- a/zio-query/shared/src/main/scala/zio/query/internal/BlockedRequests.scala +++ b/zio-query/shared/src/main/scala/zio/query/internal/BlockedRequests.scala @@ -312,7 +312,7 @@ private[query] object BlockedRequests { map: mutable.HashMap[Request[_, _], Exit[Any, Any]] )(implicit trace: Trace): UIO[Unit] = cache match { - case cache: Cache.InMemory => + case cache: Cache.InMemoryCache => ZIO.succeedUnsafe { implicit unsafe => map.foreach { case (request: Request[Any, Any], exit) => cache