Skip to content

Commit

Permalink
Merge pull request #1172 from karesti/create-cache-with-minimal-config
Browse files Browse the repository at this point in the history
Infinispan create cache with minimal defauls
  • Loading branch information
rsvoboda authored Sep 15, 2022
2 parents eb748df + 5903511 commit b6483e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,21 @@
import javax.enterprise.event.Observes;
import javax.inject.Inject;

import io.quarkus.infinispan.client.Remote;
import io.quarkus.logging.Log;
import org.infinispan.client.hotrod.RemoteCache;
import org.infinispan.client.hotrod.RemoteCacheManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.quarkus.runtime.StartupEvent;

@ApplicationScoped
public class InfinispanClientApp {


@Inject
RemoteCacheManager cacheManager;
@Remote("mycache")
RemoteCache<String, String> cache;

void onStart(@Observes StartupEvent ev) {
Log.info("Get cache named mycache and add put a key/value");
RemoteCache<Object, Object> cache = cacheManager.getCache("mycache");
cache.put("hello", "Hello World, Infinispan is up!");
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
quarkus.infinispan-client.cache.mycache.configuration=<distributed-cache name="mycache"><encoding media-type="application/x-protostream"/></distributed-cache>

# Use the Infinispan Dev Service in dev and test
%prod.quarkus.infinispan-client.server-list=localhost:11222
%prod.quarkus.infinispan-client.auth-username=admin
Expand Down

0 comments on commit b6483e9

Please sign in to comment.