Class

eu.shiftforward.apso.caching

SimpleLruCache

Related Doc: package caching

Permalink

final class SimpleLruCache[V] extends Cache[V]

A thread-safe implementation of eu.shiftforward.apso.caching.Cache. The cache has a defined maximum number of entries it can store. After the maximum capacity is reached new entries cause old ones to be evicted in a last-recently-used manner, i.e. the entries that haven't been accessed for the longest time are evicted first.

Linear Supertypes
Cache[V], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SimpleLruCache
  2. Cache
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SimpleLruCache(maxCapacity: Int, initialCapacity: Int)

    Permalink

Type Members

  1. class Keyed extends AnyRef

    Permalink
    Definition Classes
    Cache

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def apply(key: Any, genValue: () ⇒ Future[V])(implicit ec: ExecutionContext): Future[V]

    Permalink

    Returns either the cached Future for the given key or evaluates the given value generating function producing a Future[V].

    Returns either the cached Future for the given key or evaluates the given value generating function producing a Future[V].

    Definition Classes
    SimpleLruCacheCache
  5. def apply(key: Any): Keyed

    Permalink

    Selects the (potentially non-existing) cache entry with the given key.

    Selects the (potentially non-existing) cache entry with the given key.

    Definition Classes
    Cache
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def ascendingKeys(limit: Option[Int] = None): Iterator[Any]

    Permalink

    Returns a snapshot view of the keys as an iterator, traversing the keys from the least likely to be retained to the most likely.

    Returns a snapshot view of the keys as an iterator, traversing the keys from the least likely to be retained to the most likely. Note that this is not constant time.

    limit

    No more than limit keys will be returned

    Definition Classes
    SimpleLruCacheCache
  8. def clear(): Unit

    Permalink

    Clears the cache by removing all entries.

    Clears the cache by removing all entries.

    Definition Classes
    SimpleLruCacheCache
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def get(key: Any): Option[Future[V]]

    Permalink

    Retrieves the future instance that is currently in the cache for the given key.

    Retrieves the future instance that is currently in the cache for the given key. Returns None if the key has no corresponding cache entry.

    Definition Classes
    SimpleLruCacheCache
  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. val initialCapacity: Int

    Permalink
  17. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  18. def keys: Set[Any]

    Permalink

    Returns the set of keys in the cache, in no particular order Should return in roughly constant time.

    Returns the set of keys in the cache, in no particular order Should return in roughly constant time. Note that this number might not reflect the exact keys of active, unexpired cache entries, since expired entries are only evicted upon next access (or by being thrown out by a capacity constraint).

    Definition Classes
    SimpleLruCacheCache
  19. val maxCapacity: Int

    Permalink
  20. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. def remove(key: Any): Option[Future[V]]

    Permalink

    Removes the cache item for the given key.

    Removes the cache item for the given key. Returns the removed item if it was found (and removed).

    Definition Classes
    SimpleLruCacheCache
  24. def size: Int

    Permalink

    Returns the upper bound for the number of currently cached entries.

    Returns the upper bound for the number of currently cached entries. Note that this number might not reflect the exact number of active, unexpired cache entries, since expired entries are only evicted upon next access (or by being thrown out by a capacity constraint).

    Definition Classes
    SimpleLruCacheCache
  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  26. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Cache[V]

Inherited from AnyRef

Inherited from Any

Ungrouped