trait AbstractCache[F[_], V] extends Cache[F, V] with LoggingSupport[F]
An abstract implementation of CacheAlg that takes care of some things that are common across all concrete implementations.
If you are writing a cache implementation, you probably want to extend this trait rather than extending CacheAlg directly.
- V
The value of types stored in the cache.
- Alphabetic
- By Inheritance
- AbstractCache
- LoggingSupport
- Cache
- CacheAlg
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- implicit abstract def F: Sync[F]
- Attributes
- protected
- Definition Classes
- AbstractCache → LoggingSupport
- abstract def close: F[Unit]
You should call this when you have finished using this Cache.
You should call this when you have finished using this Cache. (e.g. when your application shuts down)
It will take care of gracefully shutting down the underlying cache client.
Note that you should not try to use this Cache instance after you have called this method.
- Definition Classes
- CacheAlg
- abstract def config: CacheConfig
- Definition Classes
- Cache
- abstract def doGet(key: String): F[Option[V]]
- Attributes
- protected
- abstract def doPut(key: String, value: V, ttl: Option[Duration]): F[Unit]
- Attributes
- protected
- abstract def doRemove(key: String): F[Unit]
- Attributes
- protected
- abstract def doRemoveAll: F[Unit]
- Attributes
- protected
- abstract def logger: Logger[F]
- Attributes
- protected
- Definition Classes
- LoggingSupport
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
- final def caching(keyParts: Any*)(ttl: Option[Duration] = None)(f: => V)(implicit flags: Flags): F[V]
Get a value from the cache if it exists.
Get a value from the cache if it exists. Otherwise compute it, insert it into the cache, and return it.
- keyParts
The cache key
- ttl
The time-to-live to use when inserting into the cache. The cache entry will expire after this time has elapsed.
- f
A block that computes the value
- flags
Flags used to conditionally alter the behaviour of ScalaCache
- returns
The value, either retrieved from the cache or computed
- Definition Classes
- AbstractCache → CacheAlg
- def cachingF(keyParts: Any*)(ttl: Option[Duration] = None)(f: F[V])(implicit flags: Flags): F[V]
Get a value from the cache if it exists.
Get a value from the cache if it exists. Otherwise compute it, insert it into the cache, and return it.
- keyParts
The cache key
- ttl
The time-to-live to use when inserting into the cache. The cache entry will expire after this time has elapsed.
- f
A block that computes the value wrapped in a container
- flags
Flags used to conditionally alter the behaviour of ScalaCache
- returns
The value, either retrieved from the cache or computed
- Definition Classes
- AbstractCache → CacheAlg
- def cachingForMemoize(baseKey: String)(ttl: Option[Duration] = None)(f: => V)(implicit flags: Flags): F[V]
- Definition Classes
- AbstractCache → Cache
- def cachingForMemoizeF(baseKey: String)(ttl: Option[Duration])(f: F[V])(implicit flags: Flags): F[V]
- Definition Classes
- AbstractCache → Cache
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def get(keyParts: Any*)(implicit flags: Flags): F[Option[V]]
Get a value from the cache
Get a value from the cache
- keyParts
The cache key
- flags
Flags used to conditionally alter the behaviour of ScalaCache
- returns
The appropriate value, if it was found in the cache
- Definition Classes
- AbstractCache → CacheAlg
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def logCacheHitOrMiss[A](key: String, result: Option[A]): F[Unit]
Output a debug log to record the result of a cache lookup
Output a debug log to record the result of a cache lookup
- A
the type of the cache value
- key
the key that was looked up
- result
the result of the cache lookup
- Attributes
- protected
- Definition Classes
- LoggingSupport
- def logCachePut(key: String, ttl: Option[Duration]): F[Unit]
Output a debug log to record a cache insertion/update
Output a debug log to record a cache insertion/update
- key
the key that was inserted/updated
- ttl
the TTL of the inserted entry
- Attributes
- protected
- Definition Classes
- LoggingSupport
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def put(keyParts: Any*)(value: V, ttl: Option[Duration])(implicit flags: Flags): F[Unit]
Insert a value into the cache, optionally setting a TTL (time-to-live)
Insert a value into the cache, optionally setting a TTL (time-to-live)
- keyParts
The cache key
- value
The value to insert
- ttl
The time-to-live. The cache entry will expire after this time has elapsed.
- flags
Flags used to conditionally alter the behaviour of ScalaCache
- Definition Classes
- AbstractCache → CacheAlg
- final def remove(keyParts: Any*): F[Unit]
Remove the given key and its associated value from the cache, if it exists.
Remove the given key and its associated value from the cache, if it exists. If the key is not in the cache, do nothing.
- keyParts
data to be used to generate the cache key. This could be as simple as just a single String. See CacheKeyBuilder.
- Definition Classes
- AbstractCache → CacheAlg
- final def removeAll: F[Unit]
Delete the entire contents of the cache.
Delete the entire contents of the cache. Use wisely!
- Definition Classes
- AbstractCache → CacheAlg
- 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