Nothing Special   »   [go: up one dir, main page]

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

Fix master build #575

Merged
merged 3 commits into from
Sep 4, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.3, 2.12.12]
scala: [2.13.6, 2.12.14]
java: [openjdk@1.11.0]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.3]
scala: [2.13.6]
java: [openjdk@1.11.0]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -113,22 +113,22 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (2.13.3)
- name: Download target directories (2.13.6)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.13.3-${{ matrix.java }}
name: target-${{ matrix.os }}-2.13.6-${{ matrix.java }}

- name: Inflate target directories (2.13.3)
- name: Inflate target directories (2.13.6)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.12.12)
- name: Download target directories (2.12.14)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.12.12-${{ matrix.java }}
name: target-${{ matrix.os }}-2.12.14-${{ matrix.java }}

- name: Inflate target directories (2.12.12)
- name: Inflate target directories (2.12.14)
run: |
tar xf targets.tar
rm targets.tar
Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ lazy val mavenSettings = Seq(
}
)

val Scala213 = "2.13.3"
val Scala212 = "2.12.12"
val Scala213 = "2.13.6"
val Scala212 = "2.12.14"
val Jdk11 = "openjdk@1.11.0"

ThisBuild / scalaVersion := Scala213
Expand Down
23 changes: 11 additions & 12 deletions modules/docs/src/main/mdoc/docs/memoization.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ final case class Cat(id: Int, name: String, colour: String)

implicit val catsCache: Cache[IO, Cat] = MemcachedCache("localhost:11211")

// You wouldn't normally need to specify the type params for memoize.
// This is an artifact of the way this README is generated using tut.
def getCat(id: Int): IO[Cat] = memoize[IO, Cat](Some(10.seconds)) {
def getCat(id: Int): IO[Cat] = memoize(Some(10.seconds)) {
// Retrieve data from a remote API here ...
Cat(id, s"cat ${id}", "black")
}
Expand All @@ -35,7 +33,7 @@ The next time you call the method with the same arguments the result will be ret
If the result of your block is wrapped in an effect container, use `memoizeF`:

```scala mdoc
def getCatF(id: Int): IO[Cat] = memoizeF[IO, Cat](Some(10.seconds)) {
def getCatF(id: Int): IO[Cat] = memoizeF(Some(10.seconds)) {
IO {
// Retrieve data from a remote API here ...
Cat(id, s"cat ${id}", "black")
Expand All @@ -58,12 +56,13 @@ The cache key is built automatically from the class name, the name of the enclos
For example, given the following method:

```scala
package foo

object Bar {
def baz(a: Int, b: String)(c: String): Int = memoizeSync(None) {
// Reticulating splines...
123
def baz(a: Int, b: String)(c: String): Int = memoizeF(None) {
IO {
// Reticulating splines...
123
}
}
}
```
Expand All @@ -84,15 +83,15 @@ If your memoized method is inside a class, rather than an object, then the metho

For example, if your code looks like this:

```scala
```scala
package foo

class Bar(a: Int) {

def baz(b: Int): Int = memoizeSync(None) {
a + b
}

}
```

Expand All @@ -106,7 +105,7 @@ implicit val cacheConfig = CacheConfig(

Doing this will ensure that both the constructor arguments and the method arguments are included in the cache key:

```scala
```scala
new Bar(10).baz(42) // cached as "foo.Bar(10).baz(42)" -> 52
new Bar(20).baz(42) // cached as "foo.Bar(20).baz(42)" -> 62
```
Expand All @@ -129,5 +128,5 @@ will only include the `userId` argument's value in its cache keys.
import cats.effect.unsafe.implicits.global
for (cache <- List(catsCache)) {
cache.close.unsafeRunSync()
}
}
```
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.4.9
sbt.version=1.5.5
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.0")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.1.5")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.3.4")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.20")
Expand Down