List of usage examples for com.google.common.cache CacheStats toString
@Override
public String toString()
From source file:com.weigandtconsulting.javaschool.cache.App.java
public static void main(String[] args) throws IOException, ExecutionException { Book book = BookService.getBookDetails(ISBN_1).get(); System.out.println(NetworkUtil.getObjectMapper().writeValueAsString(book)); book = BookService.getBookDetails(ISBN_1).get(); book = BookService.getBookDetails(ISBN_2).get(); System.out.println(NetworkUtil.getObjectMapper().writeValueAsString(book)); book = BookService.getBookDetails(ISBN_1).get(); book = BookService.getBookDetails(ISBN_2).get(); book = BookService.getBookDetails(ISBN_1).get(); book = BookService.getBookDetails(ISBN_1).get(); book = BookService.getBookDetails(ISBN_1).get(); book = BookService.getBookDetails(ISBN_2).get(); book = BookService.getBookDetails(ISBN_2).get(); CacheStats cacheStats = BookService.getCacheStats(); System.out.println(cacheStats.toString()); }
From source file:tv.dyndns.kishibe.qmaclone.server.database.CachedDatabase.java
private void writeCacheStatsToLog() { for (Entry<String, Cache<?, ?>> e : caches.entrySet()) { String name = e.getKey(); CacheStats stats = e.getValue().stats(); double averageLoadPenalty = stats.averageLoadPenalty(); double hitRate = stats.hitRate(); String message = String.format("%s hitRate=%.2f averageLoadPenalty=%.2f %s", name, hitRate, averageLoadPenalty, stats.toString()); logger.log(Level.INFO, message); }/*from ww w . j av a 2 s . co m*/ }