org.jasig.cas.monitor
Class SimpleCacheStatistics

java.lang.Object
  extended by org.jasig.cas.monitor.SimpleCacheStatistics
All Implemented Interfaces:
CacheStatistics

public class SimpleCacheStatistics
extends Object
implements CacheStatistics

Simple implementation of cache statistics.

Since:
3.5.1
Author:
Marvin S. Addison

Constructor Summary
SimpleCacheStatistics(long size, long capacity, long evictions)
          Creates a new instance with given parameters.
SimpleCacheStatistics(long size, long capacity, long evictions, String name)
          Creates a new named instance with given parameters.
 
Method Summary
 long getCapacity()
          Gets the current capacity of the cache in a unit specific to the cache being monitored (e.g.
 long getEvictions()
          Gets the number of items evicted from the cache in order to make space for new items.
 String getName()
          Gets a descriptive name of the cache instance for which statistics apply.
 int getPercentFree()
          Gets the percent free capacity remaining in the cache.
 long getSize()
          Gets the current size of the cache in a unit specific to the cache being monitored (e.g.
 void toString(StringBuilder builder)
          Writes a string representation of cache statistics to the given string builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCacheStatistics

public SimpleCacheStatistics(long size,
                             long capacity,
                             long evictions)
Creates a new instance with given parameters.

Parameters:
size - Current cache size (e.g. items, bytes, etc).
capacity - Current cache capacity (e.g. items, bytes, etc). The units of capacity must be equal to size in order to produce a meaningful value for getPercentFree().
evictions - Number of evictions reported by cache.

SimpleCacheStatistics

public SimpleCacheStatistics(long size,
                             long capacity,
                             long evictions,
                             String name)
Creates a new named instance with given parameters.

Parameters:
size - Current cache size (e.g. items, bytes, etc).
capacity - Current cache capacity (e.g. items, bytes, etc). The units of capacity must be equal to size in order to produce a meaningful value for getPercentFree().
evictions - Number of evictions reported by cache.
name - Name of cache instance to which statistics apply.
Method Detail

getSize

public long getSize()
Description copied from interface: CacheStatistics
Gets the current size of the cache in a unit specific to the cache being monitored (e.g. bytes, items, etc).

Specified by:
getSize in interface CacheStatistics
Returns:
Current cache size.

getCapacity

public long getCapacity()
Description copied from interface: CacheStatistics
Gets the current capacity of the cache in a unit specific to the cache being monitored (e.g. bytes, items, etc).

Specified by:
getCapacity in interface CacheStatistics
Returns:
Current cache capacity.

getEvictions

public long getEvictions()
Description copied from interface: CacheStatistics
Gets the number of items evicted from the cache in order to make space for new items.

Specified by:
getEvictions in interface CacheStatistics
Returns:
Eviction count.

getPercentFree

public int getPercentFree()
Description copied from interface: CacheStatistics
Gets the percent free capacity remaining in the cache.

Specified by:
getPercentFree in interface CacheStatistics
Returns:
Percent of space/capacity free.

toString

public void toString(StringBuilder builder)
Description copied from interface: CacheStatistics
Writes a string representation of cache statistics to the given string builder.

Specified by:
toString in interface CacheStatistics
Parameters:
builder - String builder to which string representation is appended.

getName

public String getName()
Gets a descriptive name of the cache instance for which statistics apply.

Specified by:
getName in interface CacheStatistics
Returns:
Name of cache instance/host to which statistics apply.


Copyright © 2004-2013 Jasig. All Rights Reserved.