Skip to content

Instantly share code, notes, and snippets.

@ericacm
Created August 25, 2012 16:57
Show Gist options
  • Save ericacm/3467882 to your computer and use it in GitHub Desktop.
Save ericacm/3467882 to your computer and use it in GitHub Desktop.
Auto Updating Caching System - CachingBusinessService
class CachingBusinessService(bizService: BusinessService)
extends BusinessService {
implicit val timeout = Timeout(60 seconds)
val service1CacheActor =
cacheSystem.createCacheActor("service1", DATE_CACHE_SIZE, 0 seconds,
new Service1CacheActor(_, _, bizService))
// ... more actors created here
def service1(date: Date, useFoo: Boolean): Service1Result = {
val future =
service1CacheActor ? FindValue(new Service1Params(date, useFoo))
Await.result(future, timeout.duration).asInstanceOf[Option[Service1Result]]
}
// ... more service methods
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment