Skip to content

Instantly share code, notes, and snippets.

@ericacm
Created August 25, 2012 16:59
Show Gist options
  • Save ericacm/3467899 to your computer and use it in GitHub Desktop.
Save ericacm/3467899 to your computer and use it in GitHub Desktop.
Auto Updating Caching System - CacheActorObject.scala
object CacheActor {
case class FindValue(params: Params)
trait Params {
def cacheKey: String
}
// Thread pool used by findValueForSender()
val FUTURE_POOL_SIZE = 25
private lazy val findValueThreadPoolExecutor =
new ThreadPoolExecutor(FUTURE_POOL_SIZE, FUTURE_POOL_SIZE,
1, TimeUnit.MINUTES,
new ArrayBlockingQueue(FUTURE_POOL_SIZE, true))
implicit lazy val findValueExecutionContext: ExecutionContext =
ExecutionContext.fromExecutor(findValueThreadPoolExecutor)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment