MemoryCache

io.chrisdavenport.mules.MemoryCache
See theMemoryCache companion object
final class MemoryCache[F[_], K, V] extends Cache[F, K, V]

Attributes

Companion:
object
Source:
MemoryCache.scala
Graph
Supertypes
trait Cache[F, K, V]
trait Delete[F, K]
trait Insert[F, K, V]
trait Lookup[F, K, V]
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

def delete(k: K): F[Unit]

Delete an item from the cache. Won't do anything if the item is not present.

Delete an item from the cache. Won't do anything if the item is not present.

Attributes

Source:
MemoryCache.scala
def insert(k: K, v: V): F[Unit]

Insert an item in the cache, using the default expiration value of the cache.

Insert an item in the cache, using the default expiration value of the cache.

Attributes

Source:
MemoryCache.scala
def insertWithTimeout(optionTimeout: Option[TimeSpec])(k: K, v: V): F[Unit]

Insert an item in the cache, with an explicit expiration value.

Insert an item in the cache, with an explicit expiration value.

If the expiration value is None, the item will never expire. The default expiration value of the cache is ignored.

The expiration value is relative to the current clockMonotonic time, i.e. it will be automatically added to the result of clockMonotonic for the supplied unit.

Attributes

Source:
MemoryCache.scala
def lookup(k: K): F[Option[V]]

Lookup an item with the given key, and delete it if it is expired.

Lookup an item with the given key, and delete it if it is expired.

The function will only return a value if it is present in the cache and if the item is not expired.

The function will eagerly delete the item from the cache if it is expired.

Attributes

Source:
MemoryCache.scala
def lookupNoUpdate(k: K): F[Option[V]]

Lookup an item with the given key, but don't delete it if it is expired.

Lookup an item with the given key, but don't delete it if it is expired.

The function will only return a value if it is present in the cache and if the item is not expired.

The function will not delete the item from the cache.

Attributes

Source:
MemoryCache.scala

Delete all items that are expired.

Delete all items that are expired.

This is one big atomic operation.

Attributes

Source:
MemoryCache.scala
def setDefaultExpiration(defaultExpiration: Option[TimeSpec]): MemoryCache[F, K, V]

Change the default expiration value of newly added cache items. Shares an underlying reference with the other cache. Use copyMemoryCache if you want different caches.

Change the default expiration value of newly added cache items. Shares an underlying reference with the other cache. Use copyMemoryCache if you want different caches.

Attributes

Source:
MemoryCache.scala
def setOnCacheHit(onCacheHitNew: (K, V) => F[Unit]): MemoryCache[F, K, V]

Reference to this MemoryCache with the onCacheHit effect being the new function.

Reference to this MemoryCache with the onCacheHit effect being the new function.

Attributes

Source:
MemoryCache.scala
def setOnCacheMiss(onCacheMissNew: K => F[Unit]): MemoryCache[F, K, V]

Reference to this MemoryCache with the onCacheMiss effect being the new function.

Reference to this MemoryCache with the onCacheMiss effect being the new function.

Attributes

Source:
MemoryCache.scala
def setOnDelete(onDeleteNew: K => F[Unit]): MemoryCache[F, K, V]

Reference to this MemoryCache with the onDelete effect being the new function.

Reference to this MemoryCache with the onDelete effect being the new function.

Attributes

Source:
MemoryCache.scala
def setOnInsert(onInsertNew: (K, V) => F[Unit]): MemoryCache[F, K, V]

Reference to this MemoryCache with the onInsert effect being the new function.

Reference to this MemoryCache with the onInsert effect being the new function.

Attributes

Source:
MemoryCache.scala
def withOnCacheHit(onCacheHitNew: (K, V) => F[Unit]): MemoryCache[F, K, V]

Reference to this MemoryCache with the onCacheHit effect being composed of the old and new function.

Reference to this MemoryCache with the onCacheHit effect being composed of the old and new function.

Attributes

Source:
MemoryCache.scala
def withOnCacheMiss(onCacheMissNew: K => F[Unit]): MemoryCache[F, K, V]

Reference to this MemoryCache with the onCacheMiss effect being composed of the old and new function.

Reference to this MemoryCache with the onCacheMiss effect being composed of the old and new function.

Attributes

Source:
MemoryCache.scala
def withOnDelete(onDeleteNew: K => F[Unit]): MemoryCache[F, K, V]

Reference to this MemoryCache with the onDelete effect being composed of the old and new function.

Reference to this MemoryCache with the onDelete effect being composed of the old and new function.

Attributes

Source:
MemoryCache.scala
def withOnInsert(onInsertNew: (K, V) => F[Unit]): MemoryCache[F, K, V]

Reference to this MemoryCache with the onInsert effect being composed of the old and new function.

Reference to this MemoryCache with the onInsert effect being composed of the old and new function.

Attributes

Source:
MemoryCache.scala

Concrete fields

Attributes

Source:
MemoryCache.scala

Implicits

Implicits

implicit val F: Temporal[F]

Attributes

Source:
MemoryCache.scala