info.magnolia.module.cache.mbean
Class CacheMonitor

java.lang.Object
  extended by info.magnolia.module.cache.mbean.CacheMonitor
All Implemented Interfaces:
CacheMonitorMBean

@Singleton
public class CacheMonitor
extends Object
implements CacheMonitorMBean

MBean implementation for the cache status.

Version:
$Id:$
Author:
had

Constructor Summary
CacheMonitor(info.magnolia.commands.CommandsManager commandsManager)
           
 
Method Summary
 void addCache(String name)
           
 void countFlush(String name)
           
 void countStart()
           
 void flushAll()
          Will flush all entries from all configured caches.
 void flushByUUID(String repository, String uuid)
          Will flush all entries with key bound to given uuid from all configured caches.
 Map<String,Integer> getAll()
           
 int getBypasses()
          Gets number of times since the last server restart the caching policy decided to bypass cache and serve request out of repository (i.e.
 int getCachedKeysCount()
          Gets number of entries in all known caches even if those entries have been generated from content with same uuid (e.g.
 int getCachedUUIDsCount()
          Gets number of content uuids that are held in all known caches.
 Map<String,Integer> getDomainAccesses()
          Gets number of times the requests have been served for each configured domain since the last server restart.
 Map<String,Integer> getFlushes()
          Gets number of times each configured cache have been flushed since the last server restart.
 int getHits()
          Gets number of times since the last server restart the cache found and served the entry requested by client.
static CacheMonitor getInstance()
          Deprecated. since 4.5, use IoC instead
 int getPuts()
          Gets number of times since the last server restart the cached entry for the request didn't exist and was put in the cache.
 int getStartCalls()
          Gets number of times Cache Module was started since the last server restart.
 int getStopCalls()
          Gets number of times Cache Module was stopped since the last server restart.
 void logAccess(Object cacheKey)
           
 void logBehavior(String name)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheMonitor

@Inject
public CacheMonitor(info.magnolia.commands.CommandsManager commandsManager)
Method Detail

getInstance

public static CacheMonitor getInstance()
Deprecated. since 4.5, use IoC instead


countStart

public void countStart()

stop

public void stop()

logBehavior

public void logBehavior(String name)
Parameters:
name -

countFlush

public void countFlush(String name)

addCache

public void addCache(String name)

logAccess

public void logAccess(Object cacheKey)

flushAll

public void flushAll()
              throws Exception
Description copied from interface: CacheMonitorMBean
Will flush all entries from all configured caches.

Specified by:
flushAll in interface CacheMonitorMBean
Throws:
Exception

flushByUUID

public void flushByUUID(String repository,
                        String uuid)
                 throws Exception
Description copied from interface: CacheMonitorMBean
Will flush all entries with key bound to given uuid from all configured caches. In multi domain and multi locale environments, it will flush all domain and language variations of the page with given UUID from all caches.

Specified by:
flushByUUID in interface CacheMonitorMBean
Throws:
Exception

getAll

public Map<String,Integer> getAll()
Specified by:
getAll in interface CacheMonitorMBean

getHits

public int getHits()
Description copied from interface: CacheMonitorMBean
Gets number of times since the last server restart the cache found and served the entry requested by client.

Specified by:
getHits in interface CacheMonitorMBean
Returns:
number of cache hits.

getBypasses

public int getBypasses()
Description copied from interface: CacheMonitorMBean
Gets number of times since the last server restart the caching policy decided to bypass cache and serve request out of repository (i.e. for dynamic content).

Specified by:
getBypasses in interface CacheMonitorMBean
Returns:
number of cache bypasses.

getPuts

public int getPuts()
Description copied from interface: CacheMonitorMBean
Gets number of times since the last server restart the cached entry for the request didn't exist and was put in the cache.

Specified by:
getPuts in interface CacheMonitorMBean
Returns:

getStopCalls

public int getStopCalls()
Description copied from interface: CacheMonitorMBean
Gets number of times Cache Module was stopped since the last server restart.

Specified by:
getStopCalls in interface CacheMonitorMBean
Returns:
number of Cache Module stop() calls.

getStartCalls

public int getStartCalls()
Description copied from interface: CacheMonitorMBean
Gets number of times Cache Module was started since the last server restart.

Specified by:
getStartCalls in interface CacheMonitorMBean
Returns:
number of Cache Module start() calls.

getFlushes

public Map<String,Integer> getFlushes()
Description copied from interface: CacheMonitorMBean
Gets number of times each configured cache have been flushed since the last server restart.

Specified by:
getFlushes in interface CacheMonitorMBean
Returns:
names of caches and number of times each of them have been completely flushed.

getDomainAccesses

public Map<String,Integer> getDomainAccesses()
Description copied from interface: CacheMonitorMBean
Gets number of times the requests have been served for each configured domain since the last server restart. If the name of the domain doesn't appear in the list, no request have been served for this domain since the restart, yet.

Specified by:
getDomainAccesses in interface CacheMonitorMBean
Returns:
names of the domains and number of times the requests have been server for each of them.

getCachedKeysCount

public int getCachedKeysCount()
Description copied from interface: CacheMonitorMBean
Gets number of entries in all known caches even if those entries have been generated from content with same uuid (e.g. multiple language versions or multiple domain versions).

Specified by:
getCachedKeysCount in interface CacheMonitorMBean
Returns:
number of entries held by all caches.

getCachedUUIDsCount

public int getCachedUUIDsCount()
Description copied from interface: CacheMonitorMBean
Gets number of content uuids that are held in all known caches. There might be multiple entries per uuid in case multi-domain and/or multi-locale configurations are used.

Specified by:
getCachedUUIDsCount in interface CacheMonitorMBean
Returns:
number of unique content entries that are held in cache.


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.