in storehaus-core/src/main/scala/com/twitter/storehaus/WriteThroughStore.scala [40:54]
override def put(kv: (K, Option[V])): Future[Unit] = {
// write key to backing store first
backingStore.put(kv).flatMap { _ =>
// now write key to cache, best effort
cache.put(kv) rescue { case _ => Future.Unit }
} rescue { case x =>
// write to backing store failed
// now optionally invalidate the key in cache, best effort
if (invalidate) {
cache.put((kv._1, None)) transform { _ => Future.exception(x) }
} else {
Future.exception(x)
}
}
}