TryFulfillingExpiringCache

com.phasmidsoftware.lascala.cache.TryFulfillingExpiringCache
abstract class TryFulfillingExpiringCache[K, V](evaluationFunc: K => Try[V])(implicit carper: String => Unit) extends AbstractExpiringCache[K, V, Try]

This class is almost exactly like SelfFulfillingExpiringCache but the get method returns a Try[V] rather than a Option[V]. There is a corresponding change in the definition of the evaluationFunc function (passed in as a parameter).

Created by scalaprof on 4/5/16.

Type parameters

K

they key type

V

the value type

Value parameters

carper

a method which processes a String and returns Unit

evaluationFunc

the method which, in the event of a key-value not being found, will result in an (optional) value

Attributes

Graph
Supertypes
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
Known subtypes
class NonExpiringCache[K, V]

Members list

Type members

Types

type T = Try[V]

Define T as Try[V]

Define T as Try[V]

Attributes

Value members

Concrete methods

def fulfill(k: K): T

Value parameters

k

the key to be evaluated

Attributes

Returns

a V wrapped in an M

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 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
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

Inherited and Abstract 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

Inherited from:
Expiring
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 from:
Fulfilling