Package

korolev.state

cacheApiSupport

Permalink

package cacheApiSupport

Visibility
  1. Public
  2. All

Type Members

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

    Permalink

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

    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

Value Members

  1. object CachedStateStorage

    Permalink

Ungrouped