Storage

MicroStream's storage can be used as a backing store for the cache. It functions as a CacheWriter as well as a CacheReader, depending on the writeThrough and readThrough configuration. Per default it is used for both.

EmbeddedStorageManager storageManager = EmbeddedStorage.start();
CachingProvider        provider       = Caching.getCachingProvider();  
CacheManager           cacheManager   = provider.getCacheManager();   
CacheConfiguration<Integer, String> configuration = CacheConfiguration
			.Builder(Integer.class, String.class, "my-cache", storageManager)
			.build(); 
Cache<Integer, String> cache = cacheManager.createCache("jCache", configuration);

If you prefer an external configuration, you can link the storage configuration:

keyType = java.lang.Integer
valueType = java.lang.String

readThrough = true
writeThrough = true

storageConfigurationResourceName = microstream-storage.properties

Or you can embed the storage configuration using the storage. prefix:

Spring example:

Last updated