Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinispan create cache with minimal defauls #1172

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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