Trait

org.argus.jawa.core.util

CacheProvider

Related Doc: package util

Permalink

trait CacheProvider[K] extends AnyRef

Cache provider for save Object to predefined factory and load Object from cacheMap or factory.

For save Object you can use save[T](key: Cache.key, value: T) to save Object which type is T to factory.

For load Object you can use load[T](key: Cache.key), if the Object exist in cacheMap load it from cacheMap, if not load it from factory.

Use the cache provider you need to configuration the size of cacheMap, remove strategy, serializer and unSerializer.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CacheProvider
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def cacheMap: MMap[K, (Any, Int)]

    Permalink
  2. abstract def cacheUpdate(key: K): Unit

    Permalink

    When one of the item used in the cacheMap, first update the item used number.

    When one of the item used in the cacheMap, first update the item used number.

    key

    key of the cacheMap.

  3. abstract def collectCacheMap(): Unit

    Permalink

    Based on percent number, remove items from cacheMap.

  4. abstract def load[T](key: K): T

    Permalink

    Load object from either cacheMap or file.

    Load object from either cacheMap or file. If the Object exist in cacheMap load it from cacheMap, otherwise load it from file and store it into cacheMap. When the cacheMap full, based on your preset strategy collect some of the items in cacheMap.

    Need to preset: setCacheSize, setRemovePercent, addValueSerializer.

    key

    1. generate file name; 2. key in the cacheMap.

    returns

    Object which type is T

  5. abstract val removePercent: Int

    Permalink
  6. abstract def save[T](key: K, value: T): Unit

    Permalink

    Save 'value' to file.

    Save 'value' to file.

    Need to preset: addValueSerializer.

    key

    generate file name.

    value

    the Object (which type is T) you want to store.

  7. abstract val serializer: -->[(Any, OutputStream), Unit]

    Permalink
  8. abstract def setCacheSize(size: Int): Unit

    Permalink

    Define the size of cacheMap.

    Define the size of cacheMap.

    size

    It's an Int number which defines size of the cacheMap.

  9. abstract def setRemovePercent(p: Int): Unit

    Permalink

    If the cacheMap is full, based on the percent defined here to remove proper percent of items from cacheMap.

    If the cacheMap is full, based on the percent defined here to remove proper percent of items from cacheMap.

    p

    Percent of items need to remove.

  10. abstract def setValueSerializer(f: -->[(Any, OutputStream), Unit], g: -->[InputStream, Any]): Unit

    Permalink

    Set serializer and unserializer to covert value to proper type.

    Set serializer and unserializer to covert value to proper type.

    f

    serializer, which convert any type to string and put it to output stream.

    g

    unserializer, which get string from input stream and convert to any type.

  11. abstract val size: Int

    Permalink
  12. abstract val unSerializer: -->[InputStream, Any]

    Permalink

Concrete 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. final def getClass(): Class[_]

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

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

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

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

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

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

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

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

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped