Created
August 25, 2012 17:19
-
-
Save ericacm/3468129 to your computer and use it in GitHub Desktop.
Auto Updating Caching System - Service1CacheActor.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Service1CacheActor(val cache: Cache, cacheSystem: CacheSystem, | |
bizService: BusinessService) | |
extends DateCacheActor[JList[Service1Result]](cacheSystem) { | |
override def receive = super.receive | |
override def updateCacheForDate(date: Date) { | |
import DateCacheActor._ | |
Future { findObject(new Service1Params(date, true)) } | |
Future { findObject(new Service1Params(date, false)) } | |
} | |
def finder(params: Params) = { () => | |
params match { | |
case p: Service1Params => bizService.service1(p.date, p.useFoo) | |
case _ => throw new IllegalArgumentException("...") | |
} | |
} | |
} | |
class Service1Params(date: Date, val useFoo: Boolean) | |
extends DateParams(date) { | |
override def cacheKey = super.cacheKey + ":" + useFoo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment