Skip to content

Commit

Permalink
Merge pull request #258 from cb372/remove-monix-module
Browse files Browse the repository at this point in the history
Remove the Monix integration module
  • Loading branch information
cb372 committed Jun 16, 2019
2 parents c29b8a1 + 24da8b8 commit 26391ab
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -2,7 +2,7 @@ sudo: false
language: scala
scala:
- 2.11.12
- 2.12.6
- 2.12.8
jdk:
- oraclejdk8
services:
Expand Down
14 changes: 1 addition & 13 deletions build.sbt
Expand Up @@ -42,7 +42,6 @@ lazy val root: Project = Project(id = "scalacache", base = file("."))
caffeine,
ohc,
catsEffect,
monix,
scalaz72,
circe,
tests
Expand Down Expand Up @@ -151,16 +150,6 @@ lazy val catsEffect = jvmOnlyModule("cats-effect")
coverageFailOnMinimum := true
)

lazy val monix = jvmOnlyModule("monix")
.settings(
libraryDependencies ++= Seq(
"io.monix" %% "monix" % "3.0.0-RC2"
),
coverageMinimum := 80,
coverageFailOnMinimum := true
)
.dependsOn(catsEffect)

lazy val scalaz72 = jvmOnlyModule("scalaz72")
.settings(
libraryDependencies ++= Seq(
Expand Down Expand Up @@ -193,7 +182,7 @@ lazy val circe = jvmOnlyModule("circe")

lazy val tests = jvmOnlyModule("tests")
.settings(publishArtifact := false)
.dependsOn(cache2k, caffeine, memcached, redis, ohc, catsEffect, monix, scalaz72, twitterUtil, circe)
.dependsOn(cache2k, caffeine, memcached, redis, ohc, catsEffect, scalaz72, twitterUtil, circe)

lazy val doc = jvmOnlyModule("doc")
.enablePlugins(MicrositesPlugin)
Expand Down Expand Up @@ -221,7 +210,6 @@ lazy val doc = jvmOnlyModule("doc")
caffeine,
ohc,
catsEffect,
monix,
scalaz72,
twitterUtil,
circe
Expand Down
20 changes: 13 additions & 7 deletions modules/doc/src/main/tut/docs/modes.md
Expand Up @@ -57,24 +57,30 @@ libraryDependencies += "com.github.cb372" %% "scalacache-cats-effect" % "0.27.0"
```

```tut:silent
import scalacache.CatsEffect.modes._
import scalacache.Mode
import cats.effect.IO
implicit val mode: Mode[IO] = scalacache.CatsEffect.modes.async
```

* Wraps the operation in `IO`, deferring execution until it is explicitly run

#### Monix Task
#### Monix Task (Monix 3.x)

You will need a dependency on the `scalacache-monix` module:
You will need a dependency on the `scalacache-cats-effect` module:

```
libraryDependencies += "com.github.cb372" %% "scalacache-monix" % "0.27.0"
libraryDependencies += "com.github.cb372" %% "scalacache-cats-effect" % "0.27.0"
```

```tut:silent
import scalacache.Monix.modes._
```scala
import monix.eval.Task
implicit val mode: Mode[Task] = scalacache.CatsEffect.modes.async
```

* Wraps the operation in `Task`, deferring execution until it is explicitly run
* Wraps the operation in Monix `Task`, deferring execution until it is explicitly run

Note: There used to a `scalacache-monix` module but it was removed because it
didn't do very much.

#### Scalaz Task

Expand Down
15 changes: 0 additions & 15 deletions modules/monix/src/main/scala/scalacache/Monix.scala

This file was deleted.

Expand Up @@ -5,7 +5,6 @@ import java.util.UUID
import org.scalatest._
import cats.effect.{IO => CatsIO}
import com.twitter.util.{Future => TwitterFuture, Await => TwitterAwait}
import monix.eval.{Task => MonixTask}
import scalaz.concurrent.{Task => ScalazTask}
import net.spy.memcached.{AddrUtil, MemcachedClient}
import redis.clients.jedis.JedisPool
Expand Down Expand Up @@ -112,29 +111,6 @@ class IntegrationTests extends FlatSpec with Matchers with BeforeAndAfterAll {
assert(result.contains("prepended " + initialValue))
}

s"$name ⇔ (Monix Task)" should "defer the computation and give the correct result" in {
implicit val theCache: Cache[String] = cache
implicit val mode: Mode[MonixTask] = Monix.modes.task

val key = UUID.randomUUID().toString
val initialValue = UUID.randomUUID().toString

val program =
for {
_ <- put(key)(initialValue)
readFromCache <- get(key)
updatedValue = "prepended " + readFromCache.getOrElse("couldn't find in cache!")
_ <- put(key)(updatedValue)
finalValueFromCache <- get(key)
} yield finalValueFromCache

checkComputationHasNotRun(key)

val future = program.runAsync(monix.execution.Scheduler.global)
val result = Await.result(future, Duration.Inf)
assert(result.contains("prepended " + initialValue))
}

s"$name ⇔ (Scalaz Task)" should "defer the computation and give the correct result" in {
implicit val theCache: Cache[String] = cache
implicit val mode: Mode[ScalazTask] = Scalaz72.modes.task
Expand Down

0 comments on commit 26391ab

Please sign in to comment.