protected static void printNearCacheStats(ICache<Integer, Article> cache) { NearCacheStats stats = cache.getLocalCacheStatistics().getNearCacheStatistics(); System.out.printf("The Near Cache contains %d entries.%n", stats.getOwnedEntryCount()); System.out.printf("The first article instance was retrieved from the remote instance (Near Cache misses: %d).%n", stats.getMisses()); System.out.printf( "The second and third article instance were retrieved from the local Near Cache (Near Cache hits: %d).%n", stats.getHits()); }
protected static void printNearCacheStats(IMap<?, Article> map) { NearCacheStats stats = map.getLocalMapStats().getNearCacheStats(); System.out.printf("The Near Cache contains %d entries.%n", stats.getOwnedEntryCount()); System.out.printf("The first article instance was retrieved from the remote instance (Near Cache misses: %d).%n", stats.getMisses()); System.out.printf( "The second and third article instance were retrieved from the local Near Cache (Near Cache hits: %d).%n", stats.getHits()); }
public static void main(String[] args) { HazelcastInstance node = Hazelcast.newHazelcastInstance(newConfig()); IMap<String, String> map = node.getMap("default"); for (int i = 0; i < 1000; i++) { map.put("key-" + i, "value-" + i); } // first get() populates the Near cache with the remote entry for (int i = 0; i < 1000; i++) { map.get("key-" + i); } long ownedEntryCount = map.getLocalMapStats().getNearCacheStats().getOwnedEntryCount(); System.out.println("Near Cache includes " + ownedEntryCount + " entries"); node.shutdown(); }
protected static void printNearCacheStats(ICache<?, ?> cache, String message) { NearCacheStats stats = cache.getLocalCacheStatistics().getNearCacheStatistics(); System.out.printf("%s (%d entries, %d hits, %d misses, %d evictions, %d expirations)%n", message, stats.getOwnedEntryCount(), stats.getHits(), stats.getMisses(), stats.getEvictions(), stats.getExpirations()); }
protected static void printNearCacheStats(IMap<?, Article> map, String message) { NearCacheStats stats = map.getLocalMapStats().getNearCacheStats(); System.out.printf("%s (%d entries, %d hits, %d misses, %d evictions, %d expirations)%n", message, stats.getOwnedEntryCount(), stats.getHits(), stats.getMisses(), stats.getEvictions(), stats.getExpirations()); }
public static void main(String[] args) { // start server HazelcastInstance server = Hazelcast.newHazelcastInstance(newConfig()); // start client HazelcastInstance client = HazelcastClient.newHazelcastClient(newClientConfig("mapName")); IMap<String, String> map = client.getMap("mapName"); for (int i = 0; i < 1000; i++) { map.put("key-" + i, "value-" + i); } // first get() populates the Near cache with the remote entry for (int i = 0; i < 1000; i++) { map.get("key-" + i); } long ownedEntryCount = map.getLocalMapStats().getNearCacheStats().getOwnedEntryCount(); System.out.println("Near cache includes " + ownedEntryCount + " entries"); client.shutdown(); server.shutdown(); }
while (stats.getOwnedEntryCount() != MAP_SIZE) { sleepMillis(500);