Search in sources :

Example 1 with CacheEntry

use of org.apache.archiva.rest.api.model.CacheEntry in project archiva by apache.

the class DefaultSystemStatusService method getCacheEntries.

@Override
public List<CacheEntry> getCacheEntries() throws ArchivaRestServiceException {
    List<CacheEntry> cacheEntries = new ArrayList<CacheEntry>(caches.size());
    DecimalFormat decimalFormat = new DecimalFormat("#%");
    for (Map.Entry<String, Cache> entry : caches.entrySet()) {
        CacheStatistics cacheStatistics = entry.getValue().getStatistics();
        cacheEntries.add(new CacheEntry(entry.getKey(), cacheStatistics.getSize(), cacheStatistics.getCacheHits(), cacheStatistics.getCacheMiss(), decimalFormat.format(cacheStatistics.getCacheHitRate()).toString(), cacheStatistics.getInMemorySize()));
    }
    Collections.sort(cacheEntries, new CacheEntryComparator());
    return cacheEntries;
}
Also used : CacheStatistics(org.apache.archiva.redback.components.cache.CacheStatistics) DecimalFormat(java.text.DecimalFormat) ArrayList(java.util.ArrayList) CacheEntry(org.apache.archiva.rest.api.model.CacheEntry) Map(java.util.Map) Cache(org.apache.archiva.redback.components.cache.Cache)

Aggregations

DecimalFormat (java.text.DecimalFormat)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Cache (org.apache.archiva.redback.components.cache.Cache)1 CacheStatistics (org.apache.archiva.redback.components.cache.CacheStatistics)1 CacheEntry (org.apache.archiva.rest.api.model.CacheEntry)1