com.gilt.gfc.guava.cache

ShutdownableLoadingCache

Related Doc: package cache

trait ShutdownableLoadingCache[K, V] extends LoadingCache[K, V]

Wrapper for Guava's LoadingCache/CacheBuilder API with a bulk cache load and replacement strategy. To use this, at a minimum you pass in a reload period in ms, which dictates how often to reload the cache. Note that this is the amount of time between the end of one reload operation, and the next; this does not try to maintain a constant frequency. You must also pass in a reloader method, which is called to get an iterator of the key/value pairs to put in the cache. Finally you may pass in an optional CacheBuilder instance, which is used to actually create the cache, an onMiss function, which is called from the Guava CacheLoader.load method to decide what to do when there is a cache miss (default behavior is a RuntimeException); and an executor which is used to actually schedule cache reloads.

Note that caching, and Guava's caching, are hard topics. For example it is rarely a good idea to have a read-back cache in Gilt's business model -- in general we never want to miss cache, which is what this implementation is tuned for. But you may have some luck tweaking specific behavior by passing in your own CacheBuilder. Please do read the Guava documentation carefully before embarking upon advanced use.

Since

5/21/12 7:02 AM

Linear Supertypes
LoadingCache[K, V], Function[K, V], Cache[K, V], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ShutdownableLoadingCache
  2. LoadingCache
  3. Function
  4. Cache
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def asMap(): ConcurrentMap[K, V]

    Definition Classes
    LoadingCache → Cache
  2. abstract def cleanUp(): Unit

    Definition Classes
    Cache
  3. abstract def get(arg0: K): V

    Definition Classes
    LoadingCache
    Annotations
    @throws( ... )
  4. abstract def get(arg0: K, arg1: Callable[_ <: V]): V

    Definition Classes
    Cache
    Annotations
    @throws( ... )
  5. abstract def getAll(arg0: Iterable[_ <: K]): ImmutableMap[K, V]

    Definition Classes
    LoadingCache
    Annotations
    @throws( ... )
  6. abstract def getAllPresent(arg0: Iterable[_]): ImmutableMap[K, V]

    Definition Classes
    Cache
  7. abstract def getIfPresent(arg0: Any): V

    Definition Classes
    Cache
    Annotations
    @Nullable()
  8. abstract def getUnchecked(arg0: K): V

    Definition Classes
    LoadingCache
  9. abstract def invalidate(arg0: Any): Unit

    Definition Classes
    Cache
  10. abstract def invalidateAll(): Unit

    Definition Classes
    Cache
  11. abstract def invalidateAll(arg0: Iterable[_]): Unit

    Definition Classes
    Cache
  12. abstract def put(arg0: K, arg1: V): Unit

    Definition Classes
    Cache
  13. abstract def putAll(arg0: Map[_ <: K, _ <: V]): Unit

    Definition Classes
    Cache
  14. abstract def refresh(arg0: K): Unit

    Definition Classes
    LoadingCache
  15. abstract def shutdown(): Unit

  16. abstract def size(): Long

    Definition Classes
    Cache
  17. abstract def stats(): CacheStats

    Definition Classes
    Cache
  18. abstract def apply(arg0: K): V

    Definition Classes
    LoadingCache → Function
    Annotations
    @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Concrete Value Members

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

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

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

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

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

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

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

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

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

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

    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

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

    Definition Classes
    AnyRef
  16. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from LoadingCache[K, V]

Inherited from Function[K, V]

Inherited from Cache[K, V]

Inherited from AnyRef

Inherited from Any

Ungrouped