Created
March 1, 2013 11:27
-
-
Save nicmarti/5064060 to your computer and use it in GitHub Desktop.
Play2 and Redis simple demo - How to load an Origin from a Redis data store with a for-comprehension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getOrigin(originId: Long): Option[Origin] = Redis.pool.withClient { | |
client => | |
for(slug<-Option(client.hget("Url:From:Rev", originId.toString)); | |
display<-Option(client.hget("Places:Place:"+originId, "display") | |
)) yield Origin(originId,display,slug) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment