The simplest way to iterate over an Infinispan Cache is by means of iterating over its Set of entries, as in the following example, which uses JDK 1.8 (Lambda expression) style:

cache.entrySet().forEach(entry -> System.out.printf("%s = %s\n", entry.getKey(), entry.getValue()));

 The above example will print cache statistics for the whole cluster. On the other hand, if you want to display Cache entries just for the current node, then you could use the Flag.SKIP_REMOTE_LOOKUP on the Cache object:

.entrySet().forEach(entry -> System.out.printf("%s = %s\n", entry.getKey(), entry.getValue()));

 See the full example:


Related articles available on

Getting Started with Infinispan - Part 1

This tutorial has been updated to work with the lastes Infinispan

Infinispan tutorial part 2

In the first tutorial we have covered some basic concepts about I

Infinispan RESTful interface

This is an update for Infinispan REST tutorial which is based on

Develop a clustered application with Infinispan Data Grid

In this tutorial we will use Infinispan Data Grid Platform to sto

Using Infinispan with WildFly

The Infinispan subsystem provides caching support for HA services

Using Infinispan Query API

Applications using a NoSQL storage often need to query data using