Class

io.buoyant.namerd.iface

ObserverCache

Related Doc: package iface

Permalink

class ObserverCache[K <: AnyRef, T] extends AnyRef

A cache for Observer[T]. ObserverCache contains two levels of caching: active and inactive.

The active cache is for Observers that have current outstanding requests against them. Therefore, any Observer in the active cache must not be closed as this would cause the outstanding requests to hang.

The inactive cache is for Observers without outstanding requests against them. These Observers are kept open while in the inactive cache in case they receive a request and need to be moved to the active cache. The inactive cache has LRU eviction and Observers are closed upon eviction. Since Observers in the inactive cache have no outstanding requests against them, this is safe to do.

When get is called, the Observer for that key is moved to the active cache if it exists or created and placed in the active cache if it does not exist. When the value of an Observer in the active cache changes, the Observer is moved to the inactive cache. If the inactive cache is full at that time, an older inactive Observer will be evicted.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ObserverCache
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ObserverCache(activeCapacity: Int, inactiveCapacity: Int, stats: StatsReceiver, mkObserver: (K) ⇒ Observer[T])

    Permalink

    activeCapacity

    The maximum size of the active cache. If get would cause the active cache to exceed this size, a MaximumObservationsReached exception is returned instead.

    inactiveCapacity

    The maximum size of the inactive cache. LRU eviction is used to maintain this constraint.

    mkObserver

    The function to use to create new Observers if they are not in either 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. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

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

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. def get(key: K): Try[Observer[T]]

    Permalink
  10. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  16. final def synchronized[T0](arg0: ⇒ T0): T0

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

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

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped