Package org.shiftone.cache.decorator.soft

Examples of org.shiftone.cache.decorator.soft.SoftCache.addObject()


    {

        Cache cache1 = new MapCache(new Hashtable());
        Cache cache2 = new SoftCache(cache1);

        cache2.addObject("key", "value");
        assertEquals("value", cache2.getObject("key"));
    }


    public void testReference() throws Exception
View Full Code Here


        SoftCache softCache;

        mapCache  = new MapCache(new Hashtable());
        softCache = new SoftCache(mapCache);

        softCache.addObject("key", inObject);

        outObject = mapCache.getObject("key");

        assertTrue("outObject instanceof Reference", outObject instanceof Reference);
        assertTrue("cache2.getObject('key') == inObject", softCache.getObject("key") == inObject);
View Full Code Here

        for (int i = 0; i < 10; i++)
        {
            Runtime.getRuntime().gc();
            Runtime.getRuntime().runFinalization();
            Runtime.getRuntime().gc();
            softCache.addObject(new Integer(i), createBigObject());

            //softCache.removeExpiredElements();
            Thread.sleep(500);
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.