Skip to content

Caching in readme #306

Description

@DenisNovac

There is this example of caching at the end of readme:

def fetchTwice[F[_] : Concurrent]: Fetch[F, (String, String)] = for {
  one <- fetchString(1)
  two <- fetchString(1)
} yield (one, two)

Isn't this just a deduplication? I mean, results are not saved to the next call:

val l: Fetch[IO, (Option[String], Option[String])] = for {
    d1 <- data.fetchElem(0)
    d2 <- data.fetchElem(0)
  } yield (d1, d2)
  Fetch.run(l).unsafeRunSync()  // asks for elem 0 once
  Fetch.run(data.fetchElem(0)).unsafeRunSync()  // asks for elem 0 too, not cached?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions