Skip to content

Instantly share code, notes, and snippets.

@havocp
Created May 10, 2012
Embed
What would you like to do?
Binding implicits
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