NonExpiringCache

com.phasmidsoftware.lascala.cache.NonExpiringCache
case class NonExpiringCache[K, V](evaluate: K => Try[V])(implicit carper: String => Unit) extends TryFulfillingExpiringCache[K, V]

Basic self-fulfilling cache that uses Try

CONSIDER extending a different superclass since we don't want a cache that even has an expire method.

Type parameters

K

they key type

V

the value type

Value parameters

carper

the function to carp about a problem, of type String=>Unit

evaluate

the evaluationFunc function of type K=>Try[V] which will get the V value when it is otherwise unknown.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AbstractExpiringCache[K, V, Try]
trait Expiring[K]
class AbstractFulfillingCache[K, V, Try]
trait Fulfilling[K, V, Try]
trait Mappish[K, V, Try]
trait Cache[K, V, Try]
trait K => V
class Object
trait Matchable
class Any
Show all

Members list

Type members

Inherited types

type T = Try[V]

Define T as Try[V]

Define T as Try[V]

Attributes

Inherited from:
TryFulfillingExpiringCache

Value members

Concrete methods

def expire(k: K): Unit

method to remove a key from the cache

method to remove a key from the cache

Value parameters

k

the key to the element which is to be expired.

Attributes

def postFulfillment(k: K, v: V): Unit

method to take action whenever a key value is actually fulfilled.

method to take action whenever a key value is actually fulfilled.

Value parameters

k

the key of the element which has been fulfilled

v

the value of the element which has been fulfilled

Attributes

Inherited methods

def andThen[A](g: V => A): K => A

Composes two instances of Function1 in a new Function1, with this function applied first.

Composes two instances of Function1 in a new Function1, with this function applied first.

Type parameters

A

the result type of function g

Value parameters

g

a function R => A

Attributes

Returns

a new function f such that f(x) == g(apply(x))

Inherited from:
Function1
def apply(k: K): V

Return a V value for the given K value. This method is not normally called by users of a cache as it could result in an exception being thrown. Use get instead.

Return a V value for the given K value. This method is not normally called by users of a cache as it could result in an exception being thrown. Use get instead.

Value parameters

k

the K value we are interested in

Attributes

Returns

the corresponding V value

Inherited from:
AbstractFulfillingCache
def asMap: Map[K, V]

Attributes

Inherited from:
Mappish
def clear(): Unit

Attributes

Inherited from:
Mappish
def compose[A](g: A => K): A => V

Composes two instances of Function1 in a new Function1, with this function applied last.

Composes two instances of Function1 in a new Function1, with this function applied last.

Type parameters

A

the type to which function g can be applied

Value parameters

g

a function A => T1

Attributes

Returns

a new function f such that f(x) == apply(g(x))

Inherited from:
Function1
def contains(k: K): Boolean

Attributes

Inherited from:
Mappish
def evaluate(k: K): Try[V]

Evaluate key k as an M[V]

Evaluate key k as an M[V]

Value parameters

k

the key to be evaluated

Attributes

Returns

a V wrapped in an M

Inherited from:
AbstractFulfillingCache
def fulfill(k: K): T

Value parameters

k

the key to be evaluated

Attributes

Returns

a V wrapped in an M

Inherited from:
TryFulfillingExpiringCache
def get(k: K): Try[V]

Non-blocking call to get the value v from the cache.

Non-blocking call to get the value v from the cache.

Value parameters

k

the key of the element which we wish to get

Attributes

Returns

the value wrapped as a T

Inherited from:
Fulfilling
def mutableMap: CacheMap[K, V, Try]

Attributes

Inherited from:
AbstractFulfillingCache
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
AbstractFulfillingCache -> Function1 -> Any
Inherited from:
AbstractFulfillingCache
def unwrap(vm: Try[V]): V

Method to unwrap a value of type M[V].

Method to unwrap a value of type M[V].

Value parameters

vm

the M[V] value to be unwrapped

Attributes

Returns

the unwrapped V value

Inherited from:
AbstractFulfillingCache