trait Cache extends AnyRef
A very simple cache trait.
Implementations can write adapters that map through to this trait, i.e.
import java.util.concurrent.TimeUnit import scala.concurrent.Future import com.github.benmanes.caffeine.cache.{ Caffeine, Ticker } import play.api.libs.ws.ahc.cache.{ Cache, EffectiveURIKey, ResponseEntry } class CaffeineHttpCache extends Cache { val underlying = Caffeine.newBuilder() .ticker(Ticker.systemTicker()) .expireAfterWrite(365, TimeUnit.DAYS) .build[EffectiveURIKey, ResponseEntry]() def remove(key: EffectiveURIKey) = Future.successful(Option(underlying.invalidate(key))) def put(key: EffectiveURIKey, entry: ResponseEntry) = Future.successful(underlying.put(key, entry)) def get(key: EffectiveURIKey) = Future.successful(Option(underlying getIfPresent key )) def close(): Unit = underlying.cleanUp() }
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- Cache
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Abstract Value Members
- abstract def close(): Unit
- abstract def get(key: EffectiveURIKey): Future[Option[ResponseEntry]]
- abstract def put(key: EffectiveURIKey, entry: ResponseEntry): Future[Unit]
- abstract def remove(key: EffectiveURIKey): Future[Unit]
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)