Cache

com.phasmidsoftware.lascala.cache.Cache
See theCache companion object
trait Cache[K, V, M[_]] extends K => V

This trait defines a cache (aka memoization) of K,V key-value pairs. It extends Function1[K,V] so that the apply() method takes a K as parameter and results in a V. If you call the apply method on the cache, it may throw an exception if it is unable to fulfill the value for the given key.

Type parameters

K

they key type

M

the container type of the result of calling the get method

V

the value type

Attributes

Companion
object
Graph
Supertypes
trait K => V
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def get(k: K): M[V]

Method to get the value corresponding to key k as a M[V]. This is the "normal" method to be used to lookup values in the cache.

Method to get the value corresponding to key k as a M[V]. This is the "normal" method to be used to lookup values in the cache.

Value parameters

k

the key we are interested in

Attributes

Returns

the value wrapped as a T

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 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
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
Function1 -> Any
Inherited from:
Function1

Inherited and Abstract methods

def apply(v1: K): V

Applies the body of this function to the argument.

Applies the body of this function to the argument.

Value parameters

v1

the function argument

Attributes

Returns

the result of function application.

Inherited from:
Function1