Skip to content

Commit

Permalink
Merge pull request #99 from KarelCemus/update
Browse files Browse the repository at this point in the history
Update to Play 2.6.0, fixed API change
  • Loading branch information
KarelCemus authored Jun 26, 2017
2 parents f0fc68e + c9d4335 commit af76433
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 3 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ scalaVersion := "2.12.2"

crossScalaVersions := Seq( "2.11.11", scalaVersion.value )

val playVersion = "2.6.0-RC1" // todo update when 2.6.0
val playVersion = "2.6.0"

val connectorVersion = "1.8.0"

val specs2Version = "3.8.9"
val specs2Version = "3.9.1"

parallelExecution in Test := false

Expand All @@ -33,9 +33,7 @@ libraryDependencies ++= Seq(
// test module for play framework
"com.typesafe.play" %% "play-test" % playVersion % "test",
// logger for tests
"org.slf4j" % "slf4j-simple" % "1.7.25" % "test",
// todo remove when 2.6.0
"com.typesafe.akka" %% "akka-http-core" % "10.0.7" % "test"
"org.slf4j" % "slf4j-simple" % "1.7.25" % "test"
)

resolvers ++= Seq(
Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/play/api/cache/redis/impl/AsyncRedis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ import play.api.cache.redis._
private[ impl ] class AsyncRedis @Inject()( redis: RedisConnector, policy: RecoveryPolicy ) extends RedisCache( redis )( Builders.AsynchronousBuilder, policy ) with CacheAsyncApi with play.api.cache.AsyncCacheApi {

def getOrElseUpdate[ T: ClassTag ]( key: String, expiration: Duration )( orElse: => Future[ T ] ) = getOrFuture[ T ]( key, expiration )( orElse )

def removeAll( ): Future[ Done ] = invalidate()
}
8 changes: 5 additions & 3 deletions src/main/scala/play/api/cache/redis/impl/JavaRedis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ private[ impl ] class JavaRedis @Inject()( internal: CacheAsyncApi, environment:

def remove( key: String ): CompletionStage[ Done ] = internal.remove( key ).toJava

override def get[ T ]( key: String ): CompletionStage[ T ] =
def get[ T ]( key: String ): CompletionStage[ T ] =
getOrElse[ T ]( key, None )

override def getOrElseUpdate[ T ]( key: String, block: Callable[ CompletionStage[ T ] ] ): CompletionStage[ T ] =
def getOrElseUpdate[ T ]( key: String, block: Callable[ CompletionStage[ T ] ] ): CompletionStage[ T ] =
getOrElse[ T ]( key, Some( block ) )

override def getOrElseUpdate[ T ]( key: String, block: Callable[ CompletionStage[ T ] ], expiration: Int ): CompletionStage[ T ] =
def getOrElseUpdate[ T ]( key: String, block: Callable[ CompletionStage[ T ] ], expiration: Int ): CompletionStage[ T ] =
getOrElse[ T ]( key, Some( block ), duration = expiration.seconds )

def getOrElse[ T ]( key: String, callable: Option[ Callable[ CompletionStage[ T ] ] ], duration: Duration = Duration.Inf ): CompletionStage[ T ] = {
Expand All @@ -75,6 +75,8 @@ private[ impl ] class JavaRedis @Inject()( internal: CacheAsyncApi, environment:
play.libs.Scala.orNull( _ )
}.toJava
}

def removeAll( ) = internal.invalidate().toJava
}

private[ impl ] object JavaRedis {
Expand Down

0 comments on commit af76433

Please sign in to comment.