Example usage for com.google.common.cache CacheStats evictionCount

List of usage examples for com.google.common.cache CacheStats evictionCount

Introduction

In this page you can find the example usage for com.google.common.cache CacheStats evictionCount.

Prototype

long evictionCount

To view the source code for com.google.common.cache CacheStats evictionCount.

Click Source Link

Usage

From source file:com.comcast.cdn.traffic_control.traffic_router.core.util.DataExporter.java

private Map<String, Object> createCacheStatsMap(final CacheStats cacheStats) {
    final Map<String, Object> cacheStatsMap = new HashMap<String, Object>();
    cacheStatsMap.put("requestCount", cacheStats.requestCount());
    cacheStatsMap.put("hitCount", cacheStats.hitCount());
    cacheStatsMap.put("missCount", cacheStats.missCount());
    cacheStatsMap.put("hitRate", cacheStats.hitRate());
    cacheStatsMap.put("missRate", cacheStats.missRate());
    cacheStatsMap.put("evictionCount", cacheStats.evictionCount());
    cacheStatsMap.put("loadCount", cacheStats.loadCount());
    cacheStatsMap.put("loadSuccessCount", cacheStats.loadSuccessCount());
    cacheStatsMap.put("loadExceptionCount", cacheStats.loadExceptionCount());
    cacheStatsMap.put("loadExceptionRate", cacheStats.loadExceptionRate());
    cacheStatsMap.put("totalLoadTime", cacheStats.totalLoadTime());
    cacheStatsMap.put("averageLoadPenalty", cacheStats.averageLoadPenalty());
    return cacheStatsMap;
}

From source file:org.geoserver.geofence.rest.CacheController.java

@GetMapping(path = "/info", produces = { MediaType.TEXT_PLAIN_VALUE })
public String getCacheInfo() {
    CacheStats stats = cachedRuleReader.getStats();

    StringBuilder sb = new StringBuilder().append("RuleStats[").append(" size:")
            .append(cachedRuleReader.getCacheSize()).append("/")
            .append(cachedRuleReader.getCacheInitParams().getSize()).append(" hitCount:")
            .append(stats.hitCount()).append(" missCount:").append(stats.missCount())
            .append(" loadSuccessCount:").append(stats.loadSuccessCount()).append(" loadExceptionCount:")
            .append(stats.loadExceptionCount()).append(" totalLoadTime:").append(stats.totalLoadTime())
            .append(" evictionCount:").append(stats.evictionCount()).append("] \n");

    stats = cachedRuleReader.getAdminAuthStats();
    sb.append("AdminAuthStats[").append(" size:").append(cachedRuleReader.getCacheSize()).append("/")
            .append(cachedRuleReader.getCacheInitParams().getSize()).append(" hitCount:")
            .append(stats.hitCount()).append(" missCount:").append(stats.missCount())
            .append(" loadSuccessCount:").append(stats.loadSuccessCount()).append(" loadExceptionCount:")
            .append(stats.loadExceptionCount()).append(" totalLoadTime:").append(stats.totalLoadTime())
            .append(" evictionCount:").append(stats.evictionCount()).append("] \n");

    stats = cachedRuleReader.getUserStats();
    sb.append("UserStats[").append(" size:").append(cachedRuleReader.getUserCacheSize()).append("/")
            .append(cachedRuleReader.getCacheInitParams().getSize()).append(" hitCount:")
            .append(stats.hitCount()).append(" missCount:").append(stats.missCount())
            .append(" loadSuccessCount:").append(stats.loadSuccessCount()).append(" loadExceptionCount:")
            .append(stats.loadExceptionCount()).append(" totalLoadTime:").append(stats.totalLoadTime())
            .append(" evictionCount:").append(stats.evictionCount()).append("] \n");

    return sb.toString();
}

From source file:info.archinnov.achilles.internals.cache.StatementsCache.java

private void displayCacheStatistics() {

    long cacheSize = dynamicCache.size();
    CacheStats cacheStats = dynamicCache.stats();

    LOGGER.info("Total LRU cache size {}", cacheSize);
    if (cacheSize > (maxLRUCacheSize * 0.8)) {
        LOGGER.warn("Warning, the LRU prepared statements cache is over 80% full");
    }/* ww  w  .j a v  a  2s.com*/

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Cache statistics :");
        LOGGER.debug("\t\t- hits count : {}", cacheStats.hitCount());
        LOGGER.debug("\t\t- hits rate : {}", cacheStats.hitRate());
        LOGGER.debug("\t\t- miss count : {}", cacheStats.missCount());
        LOGGER.debug("\t\t- miss rate : {}", cacheStats.missRate());
        LOGGER.debug("\t\t- eviction count : {}", cacheStats.evictionCount());
        LOGGER.debug("\t\t- load count : {}", cacheStats.loadCount());
        LOGGER.debug("\t\t- load success count : {}", cacheStats.loadSuccessCount());
        LOGGER.debug("\t\t- load exception count : {}", cacheStats.loadExceptionCount());
        LOGGER.debug("\t\t- total load time : {}", cacheStats.totalLoadTime());
        LOGGER.debug("\t\t- average load penalty : {}", cacheStats.averageLoadPenalty());
        LOGGER.debug("");
        LOGGER.debug("");
    }
}

From source file:org.springframework.integration.jdbc.StoredProcExecutor.java

/**
 * Allows for the retrieval of metrics ({@link CacheStats}}) for the
 * {@link StoredProcExecutor#jdbcCallOperationsCache}.
 *
 * Provides the properties of {@link CacheStats} as a {@link Map}. This allows
 * for exposing the those properties easily via JMX.
 *
 * @return Map containing metrics of the JdbcCallOperationsCache
 *
 * @see StoredProcExecutor#getJdbcCallOperationsCacheStatistics()
 *///  w ww.j  a  v  a  2 s. co m
@ManagedMetric
public Map<String, Object> getJdbcCallOperationsCacheStatisticsAsMap() {
    final CacheStats cacheStats = this.getJdbcCallOperationsCacheStatistics();
    final Map<String, Object> cacheStatistics = new HashMap<String, Object>(11);
    cacheStatistics.put("averageLoadPenalty", cacheStats.averageLoadPenalty());
    cacheStatistics.put("evictionCount", cacheStats.evictionCount());
    cacheStatistics.put("hitCount", cacheStats.hitCount());
    cacheStatistics.put("hitRate", cacheStats.hitRate());
    cacheStatistics.put("loadCount", cacheStats.loadCount());
    cacheStatistics.put("loadExceptionCount", cacheStats.loadExceptionCount());
    cacheStatistics.put("loadExceptionRate", cacheStats.loadExceptionRate());
    cacheStatistics.put("loadSuccessCount", cacheStats.loadSuccessCount());
    cacheStatistics.put("missCount", cacheStats.missCount());
    cacheStatistics.put("missRate", cacheStats.missRate());
    cacheStatistics.put("totalLoadTime", cacheStats.totalLoadTime());
    return Collections.unmodifiableMap(cacheStatistics);
}

From source file:org.geoserver.geofence.web.GeofencePage.java

private String getStats(CachedRuleReader cacheRuleReader) {
    CacheStats stats = cacheRuleReader.getStats();
    return new StringBuilder().append("<b>RuleStats</b><ul>").append("<li>size: ")
            .append(cacheRuleReader.getCacheSize()).append("/")
            .append(cacheRuleReader.getCacheInitParams().getSize()).append("</li>").append("<li>hitCount: ")
            .append(stats.hitCount()).append("</li>").append("<li>missCount: ").append(stats.missCount())
            .append("</li>").append("<li>loadSuccessCount: ").append(stats.loadSuccessCount()).append("</li>")
            .append("<li>loadExceptionCount: ").append(stats.loadExceptionCount()).append("</li>")
            .append("<li>totalLoadTime: ").append(stats.totalLoadTime()).append("</li>")
            .append("<li>evictionCount: ").append(stats.evictionCount()).append("</li>").append("</ul>")
            .toString();//from  w w  w . j a v a 2s  . com

}

From source file:org.geoserver.geofence.web.GeofencePage.java

private String getUserStats(CachedRuleReader cacheRuleReader) {
    CacheStats stats;
    StringBuilder sb;//from   w w  w.  j a v a2s .c  om
    stats = cacheRuleReader.getUserStats();
    sb = new StringBuilder().append("<b>UserStats</b><ul>").append("<li>size: ")
            .append(cacheRuleReader.getUserCacheSize()).append("/")
            .append(cacheRuleReader.getCacheInitParams().getSize()).append("</li>").append("<li>hitCount: ")
            .append(stats.hitCount()).append("</li>").append("<li>missCount: ").append(stats.missCount())
            .append("</li>").append("<li>loadSuccessCount: ").append(stats.loadSuccessCount()).append("</li>")
            .append("<li>loadExceptionCount: ").append(stats.loadExceptionCount()).append("</li>")
            .append("<li>totalLoadTime: ").append(stats.totalLoadTime()).append("</li>")
            .append("<li>evictionCount: ").append(stats.evictionCount()).append("</li>").append("</ul>");
    return sb.toString();
}

From source file:com.adobe.acs.commons.util.impl.AbstractGuavaCacheMBean.java

@Override
@SuppressWarnings("squid:S1192")
public final TabularData getCacheStats() throws OpenDataException {
    // Exposing all google guava stats.
    final CompositeType cacheEntryType = new CompositeType(JMX_PN_CACHESTATS, JMX_PN_CACHESTATS,
            new String[] { JMX_PN_STAT, JMX_PN_VALUE }, new String[] { JMX_PN_STAT, JMX_PN_VALUE },
            new OpenType[] { SimpleType.STRING, SimpleType.STRING });

    final TabularDataSupport tabularData = new TabularDataSupport(new TabularType(JMX_PN_CACHESTATS,
            JMX_PN_CACHESTATS, cacheEntryType, new String[] { JMX_PN_STAT }));

    CacheStats cacheStats = getCache().stats();

    final Map<String, Object> row = new HashMap<String, Object>();

    row.put(JMX_PN_STAT, "Request Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.requestCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Hit Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.hitCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Hit Rate");
    row.put(JMX_PN_VALUE, String.format("%.0f%%", cacheStats.hitRate() * 100));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Miss Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.missCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Miss Rate");
    row.put(JMX_PN_VALUE, String.format("%.0f%%", cacheStats.missRate() * 100));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Eviction Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.evictionCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Load Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.loadCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Load Exception Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.loadExceptionCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Load Exception Rate");
    row.put(JMX_PN_VALUE, String.format("%.0f%%", cacheStats.loadExceptionRate() * 100));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Load Success Count");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.loadSuccessCount()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Average Load Penalty");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.averageLoadPenalty()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    row.put(JMX_PN_STAT, "Total Load Time");
    row.put(JMX_PN_VALUE, String.valueOf(cacheStats.totalLoadTime()));
    tabularData.put(new CompositeDataSupport(cacheEntryType, row));

    return tabularData;
}