Created
May 10, 2012 02:26
-
-
Save havocp/2650592 to your computer and use it in GitHub Desktop.
Binding implicits
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
trait CacheContext | |
trait Cache { | |
def lookup(query: String)(implicit context: CacheContext): String | |
def store(id: String, value: String)(implicit context: CacheContext): Unit | |
} | |
class BoundCache(private val delegate: Cache)(implicit private val context: CacheContext) { | |
def lookup(query: String): String = | |
delegate.lookup(query) | |
def store(id: String, value: String): Unit = | |
delegate.store(id, value) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment