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[MyState])
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.
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.
Note that creating instance of javax.cache.Cache for different data grids can differ greatly. See examples in Korolev repository.
List of JSR-107 implementations
JSR-107 Specification