Search in sources :

Example 1 with MonitoredCache

use of com.alicp.jetcache.MonitoredCache in project jetcache by alibaba.

the class DefaultCacheMonitorTest method testWithManager.

@Test
public void testWithManager() throws Exception {
    Cache c1 = createCache();
    DefaultCacheMonitor m1 = new DefaultCacheMonitor("cache1");
    Cache c2 = createCache();
    DefaultCacheMonitor m2 = new DefaultCacheMonitor("cache2");
    c1 = new MonitoredCache(c1, m1);
    c2 = new MonitoredCache(c2, m2);
    DefaultCacheMonitorManager manager = new DefaultCacheMonitorManager(2, TimeUnit.SECONDS);
    manager.start();
    manager.add(m1, m2);
    basetest(c1, m1);
    basetest(c2, m2);
    Cache mc = new MultiLevelCache(c1, c2);
    DefaultCacheMonitor mcm = new DefaultCacheMonitor("multiCache");
    mc = new MonitoredCache(mc, mcm);
    manager.add(mcm);
    basetest(mc, mcm);
    manager.stop();
//        Thread.sleep(10000);
}
Also used : MonitoredCache(com.alicp.jetcache.MonitoredCache) MultiLevelCache(com.alicp.jetcache.MultiLevelCache) Cache(com.alicp.jetcache.Cache) MonitoredCache(com.alicp.jetcache.MonitoredCache) MultiLevelCache(com.alicp.jetcache.MultiLevelCache) Test(org.junit.Test)

Aggregations

Cache (com.alicp.jetcache.Cache)1 MonitoredCache (com.alicp.jetcache.MonitoredCache)1 MultiLevelCache (com.alicp.jetcache.MultiLevelCache)1 Test (org.junit.Test)1