Skip to content

opening and closing a connection for every request, how to re-use a connection? #791

Closed Answered by gvolpe
zhaoenhz asked this question in Q&A
Discussion options

You must be logged in to vote
utf8Api.use { redis =>
  buildRestOfYourProgramHere(redis)
}

def buildRestOfYourProgramHere(redis: RedisCommands[IO, String, String]) = ???  

This concept is called "shared state" and it applies to many other things. I wrote something about it: https://typelevel.org/blog/2018/06/07/shared-state-in-fp.html

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gvolpe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants