Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CE2] Remove dependency to com.evolutiongaming:scache #519

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ lazy val journal = (project in file("journal")
hostname,
`cassandra-driver`,
scassandra,
scache0,
scache1,
scache,
`cassandra-sync`,
`scala-java8-compat`,
Pureconfig.pureconfig,
Expand Down Expand Up @@ -126,13 +125,16 @@ lazy val replicator = (Project("replicator", file("replicator"))
dependsOn (
journal % "test->test;compile->compile",
`eventual-cassandra`)
settings (libraryDependencies ++= Seq(`cats-helper`)))
settings (libraryDependencies ++= Seq(
`cats-helper`,
Logback.core % Test,
Logback.classic % Test)))

lazy val `eventual-cassandra` = (project in file("eventual-cassandra")
settings (name := "kafka-journal-eventual-cassandra")
settings commonSettings
dependsOn (journal % "test->test;compile->compile")
settings (libraryDependencies ++= Seq(scache0, scache1, scassandra)))
settings (libraryDependencies ++= Seq(scache, scassandra)))

lazy val `journal-circe` = (project in file("circe/core")
settings (name := "kafka-journal-circe")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@ import cats.{Applicative, Monad}
import com.evolutiongaming.smetrics.CollectorRegistry
import com.evolution.scache.CacheMetrics

import scala.concurrent.duration.FiniteDuration

final case class HeadCacheMetrics[F[_]](headCache: HeadCache.Metrics[F], cache: CacheMetrics[F])

object HeadCacheMetrics {

def empty[F[_]: Applicative]: HeadCacheMetrics[F] = apply(HeadCache.Metrics.empty, CacheMetrics.empty)

@deprecated("use another `apply` instead", "2023-02-13")
def apply[F[_]](headCache: HeadCache.Metrics[F], cache: com.evolutiongaming.scache.CacheMetrics[F]): HeadCacheMetrics[F] = {
apply(headCache, cache.toCacheMetrics)
}

def of[F[_]: Monad](
registry: CollectorRegistry[F],
prefix: HeadCache.Metrics.Prefix = HeadCache.Metrics.Prefix.default
Expand All @@ -30,30 +23,4 @@ object HeadCacheMetrics {
}
}


private implicit class CacheMetrics0Ops[F[_]](val self: com.evolutiongaming.scache.CacheMetrics[F]) extends AnyVal {
def toCacheMetrics: CacheMetrics[F] = {
new CacheMetrics[F] {
def get(hit: Boolean) = self.get(hit)

def load(time: FiniteDuration, success: Boolean) = self.load(time, success)

def life(time: FiniteDuration) = self.life(time)

def put = self.put

def size(size: Int) = self.size(size)

def size(latency: FiniteDuration) = self.size(latency)

def values(latency: FiniteDuration) = self.values(latency)

def keys(latency: FiniteDuration) = self.keys(latency)

def clear(latency: FiniteDuration) = self.clear(latency)

def foldMap(latency: FiniteDuration) = self.foldMap(latency)
}
}
}
}
3 changes: 1 addition & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ object Dependencies {
val retry = "com.evolutiongaming" %% "retry" % "2.1.1"
val sstream = "com.evolutiongaming" %% "sstream" % "0.2.1"
val skafka = "com.evolutiongaming" %% "skafka" % "11.16.0"
val scache0 = "com.evolutiongaming" %% "scache" % "3.6.0"
val scache1 = "com.evolution" %% "scache" % "3.8.0"
val scache = "com.evolution" %% "scache" % "3.8.0"
val `akka-test-actor` = "com.evolutiongaming" %% "akka-test-actor" % "0.1.0"

object Cats {
Expand Down