I would like to use infinispan (7.0.2.Final) to provide persistency for my server application written in java. Before I started to implement it, I tried the simplest scenario but it did not work...
i.e I implemented two simple unit tests and I run them one after another (i.e. I run them separately).
The first test consisted only of:
Cache<Object, Object> c = new DefaultCacheManager().getCache();
c.put("key1", "value1");
And the second one:
Cache<Object, Object> c = new DefaultCacheManager().getCache();
String result = (String) c.get("key1");
but I received result = null ...
What am I doing wrong? I read on infinispan pages that should run out of the box...
It seems that you are expecting persistence (not clustering as @tsykora suggested). The link with programmatic configuration is right, but you'd probably want to use SingleFileStore (as the simplest persistent store).
(code not tested but this is the idea).