<!--- get our CF_Chart_CacheManager --->
<cfscript>
/* what am I looking for */
chartCacheName='CF_Chart_CacheManager';
/* gets all the Cache Managers in EHCache */
cacheManagers = createObject('java', 'net.sf.ehcache.CacheManager').ALL_CACHE_MANAGERS;
for (item in cacheManagers) {
writeOutput('EHCache Manager Instance Name:' & #item.getName()# & '<br />');
/* pluck our Chart Cache */
if ( item.getName() == chartCacheName ) {
cm = item;
thisCache = cm.getCache(chartCacheName);
}
}
if(!isdefined('thisCache')) {
WriteOutput("CF_Chart_CacheManager doesn't exist yet.");
abort;
}
/* override configuration settings */
//thisCache.getCacheConfiguration().setTimeToLiveSeconds(30);
//thisCache.getCacheConfiguration().setTimeToIdleSeconds(30);
//thisCache.getCacheConfiguration().maxElementsInMemory(5);
</cfscript>
<!--- output some stats --->
<cfoutput>
<ul>
<li>Count: #NumberFormat(thisCache.getStatistics().getSize())#</li>
<li>Max Elements In Memory: #numberformat(thisCache.getCacheConfiguration().getMaxelementsInMemory())#</li>
<li>Disk Persistance: #YesNoFormat(thisCache.getCacheConfiguration().isDiskPersistent())#</li>
<li>Eternal: #YesNoFormat(thisCache.getCacheConfiguration().isEternal())#</li>
<li>Overflow To Disk: #YesNoFormat(thisCache.getCacheConfiguration().isOverflowToDisk())#</li>
<li>Time To Live: #NumberFormat(thisCache.getCacheConfiguration().getTimeToLiveSeconds())#</li>
<li>Time To Idle: #NumberFormat(thisCache.getCacheConfiguration().getTimeToIdleSeconds())#</li>
<li>Exists: #YesNoFormat(cm.cacheExists(chartCacheName))#</li>
</ul>
</cfoutput>
<!--- chart it, ironic --->
<cfchart format="png" chartwidth="600">
<cfchartseries type="bar" colorlist="##00FF00,##CC0000,##CCFF00,##FF0000,##CC0099,##0000FF,##FFFF66,##FFFFFF">
<cfchartdata item="Count" value="#thisCache.getStatistics().getSize()#" />
<cfchartdata item="Hits" value="#thisCache.getStatistics().cacheHitCount()#">
<cfchartdata item="Disk Hits" value="#thisCache.getStatistics().localDiskHitCount()#" />
<cfchartdata item="Memory Hits" value="#thisCache.getStatistics().localHeapHitCount()#" />
<cfchartdata item="Memory Misses" value="#thisCache.getStatistics().localHeapMissCount()#" />
<cfchartdata item="On Disk" value="#thisCache.getStatistics().getLocalDiskSize()#" />
<cfchartdata item="On Heap" value="#thisCache.getStatistics().getLocalHeapSize()#" />
<cfchartdata item="Off Heap" value="#thisCache.getStatistics().getLocalOffHeapSize()#" />
</cfchartseries>
</cfchart>
<!--- get methods we can call --->
<cfset WriteDump(thisCache.getStatistics())>
<!--- dump all the keys in this cache --->
<cfset WriteDump(thisCache.getKeys())>