Skip to content

Commit

Permalink
Use List instead of Seq for cache values
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilquist committed Dec 17, 2022
1 parent 561144b commit fcbc8fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions modules/core/shared/src/main/scala/data/SemispaceCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ sealed abstract case class SemispaceCache[K, V](gen0: Map[K, V], gen1: Map[K, V]
def containsKey(k: K): Boolean =
gen0.contains(k) || gen1.contains(k)

def values: Seq[V] =
(gen0.values.toSet | gen1.values.toSet).toSeq
def values: List[V] =
(gen0.values.toSet | gen1.values.toSet).toList
}

object SemispaceCache {
Expand Down
6 changes: 3 additions & 3 deletions modules/core/shared/src/main/scala/util/StatementCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ sealed trait StatementCache[F[_], V] { outer =>
private[skunk] def put(k: Statement[_], v: V): F[Unit]
def containsKey(k: Statement[_]): F[Boolean]
def clear: F[Unit]
def values: F[Seq[V]]
def values: F[List[V]]

def mapK[G[_]](fk: F ~> G): StatementCache[G, V] =
new StatementCache[G, V] {
def get(k: Statement[_]): G[Option[V]] = fk(outer.get(k))
def put(k: Statement[_], v: V): G[Unit] = fk(outer.put(k, v))
def containsKey(k: Statement[_]): G[Boolean] = fk(outer.containsKey(k))
def clear: G[Unit] = fk(outer.clear)
def values: G[Seq[V]] = fk(outer.values)
def values: G[List[V]] = fk(outer.values)
}

}
Expand Down Expand Up @@ -53,7 +53,7 @@ object StatementCache {
def clear: F[Unit] =
ref.set(SemispaceCache.empty[Statement.CacheKey, V](max))

def values: F[Seq[V]] =
def values: F[List[V]] =
ref.get.map(_.values)
}
}
Expand Down

0 comments on commit fcbc8fd

Please sign in to comment.