Intro
Reading more about JBoss and stuff, I came upon a cache mechanism called Infinispan. 100% open source and in Java.
Infinispan
It is a NoSQL data store used for key-value aka “distributed in-memory key/value data store with optional schema”.
It can be used – with Stream API – for map-reduce schemes. It follows the JS 107 standard.
Configuring cache: either programmatically or declaratively
From the User Guide, we can see the possibility to configure the cache using the CacheManager and the ConfigurationBuilder API, since CacheManager is Infinispan main entry point, the example as follow – programmatically:
EmbeddedCacheManager manager = new DefaultCacheManager("my-config-file.xml");
Cache defaultCache = manager.getCache();
For declarative you must specify the features on the configuration schema xml. The example was stolen from the source.
<infinispan>
<cache-container default-cache="local">
<transport cluster="mycluster"/>
<local-cache name="local"/>
<invalidation-cache name="invalidation" mode="SYNC"/>
<replicated-cache name="repl-sync" mode="SYNC"/>
<distributed-cache name="dist-sync" mode="SYNC"/>
</cache-container>
</infinispan>
We can see here that the configuration applies to the default-cache on local
Features
Clustered cache: it’s a way to use several nodes for the cache information
Replicated cache: Just one node might fail, so it’s possible to replicate the data
Data Grid: you can use persist the information as a Datagrid