New in OSCache 2.4 is support for JMX monitoring and administration via the Spring Framework.

In oscache.properties, enable the statistic listener:

cache.event.listeners= com.opensymphony.oscache.extra.StatisticListenerImpl

Then add this to the Spring application context

<!-- create mbeanserver, this doesn't need to be done if running on an Appserver with 
it's own JMX server, such as Tomcat -->
<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"/>

<!-- create a connector on port 1109 -->
<bean id="registry"
	class="org.springframework.remoting.rmi.RmiRegistryFactoryBean">
	<property name="port">
		<value>1109</value>
	</property>
</bean>

<bean id="serverConnector" depends-on="registry"
	class="org.springframework.jmx.support.ConnectorServerFactoryBean">
	<property name="objectName">
		<value>connector:name=rmi</value>
	</property>
	<property name="serviceUrl">
		<value>service:jmx:rmi://localhost/jndi/rmi://localhost:1109/jmxconnector</value>
	</property>			
</bean>  

<!-- export the oscache stats beans -->
<bean id="exporter"
      class="org.springframework.jmx.export.MBeanExporter">
	<property name="beans">
		<map>   
                <entry key="bean:name=StatisticListenerImpl">
				<value>StatisticListenerImpl</value>
		</entry>	                
		</map>
	</property>
</bean>

<!-- oscache stats bean -->
<bean id="StatisticListenerImpl" class="com.opensymphony.oscache.extra.StatisticListenerImpl"/>