No var in Akka's actor — context.become
class MyActor extends Actor {
def receive = active(Set.empty)
def active(isInSet: Set[String]): Receive = {
case Add(key) =>
context become active(isInSet + key)
case Contains(key) =>
sender() ! isInSet(key)
}
}