Class/Object

korolev.state.cacheApiSupport

CachedStateStorage

Related Docs: object CachedStateStorage | package cacheApiSupport

Permalink

final class CachedStateStorage[F[_], S] extends StateStorage[F, S]

State storage based on Java Temporary Caching API (JSR-107) .

In production we work with huge number of session which cannot be served by single node. When servers number is more than one our system become distributed. It means we need to synchronize state between nodes. CachedStateStorage helps to solve this problem.

CachedStateStorage uses standard Java Caching API allows your app to work with any in-memory cache which is support that standard.

val cachingProvider = Caching.getCachingProvider()
val cacheManager = cachingProvider.getCacheManager()
val cache = cacheManager.getCache("default", classOf[String], classOf[Any])

CachedStateStorage[Future, MyState] (cache) { deviceId =>
 ...
}

Note that creating instance of javax.cache.Cache for different data grids can differ greatly. See examples in Korolev repository.

See also

List of JSR-107 implementations

JSR-107 Specification

Linear Supertypes
StateStorage[F, S], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CachedStateStorage
  2. StateStorage
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new CachedStateStorage(cache: Cache[String, Array[Byte]], createTopLevelState: (DeviceId) ⇒ F[S])(implicit arg0: Async[F], keysW: StateSerializer[Set[String]], keysR: StateDeserializer[Set[String]])

    Permalink

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. def create(deviceId: DeviceId, sessionId: SessionId): F[StateManager[F]]

    Permalink
    Definition Classes
    CachedStateStorage → StateStorage
  7. val createTopLevelState: (DeviceId) ⇒ F[S]

    Permalink
    Definition Classes
    CachedStateStorage → StateStorage
  8. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def get(deviceId: DeviceId, sessionId: SessionId): F[Option[StateManager[F]]]

    Permalink
    Definition Classes
    CachedStateStorage → StateStorage
  12. final def getClass(): Class[_]

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

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

    Permalink
    Definition Classes
    Any
  15. implicit val keysR: StateDeserializer[Set[String]]

    Permalink
  16. implicit val keysW: StateSerializer[Set[String]]

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

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

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

    Permalink
    Definition Classes
    AnyRef
  20. def remove(deviceId: DeviceId, sessionId: SessionId): Unit

    Permalink
    Definition Classes
    CachedStateStorage → StateStorage
  21. final def synchronized[T0](arg0: ⇒ T0): T0

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

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

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

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

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

Inherited from StateStorage[F, S]

Inherited from AnyRef

Inherited from Any

Ungrouped