Package org.shiftone.cache

Examples of org.shiftone.cache.Cache.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


        Cache  cache      = new LfuCacheFactory().newInstance("testSimple", 1000, 50);
        Object object     = new Object();
        String longString = "this is a string but it's not really that long";

        cache.addObject(longString, object);
        assertNotNull(cache.getObject(longString));
    }

    /*
        public void testSimpleNull()
View Full Code Here

        CacheFactory factory = new FifoCacheFactory();
        Cache        cache   = factory.newInstance("test", 10000, 10000);

        LOG.info("cache = " + cache);
        cache.addObject("test", "test");
        Thread.sleep(5000);

        cache = null;

        Thread.sleep(5000);
View Full Code Here

        Cache cache = newCache(1000 * 60, 1000);

        for (int i = 0; i < 10000; i++)
        {
            cache.addObject("k-" + i, "v-" + i);
        }

        assertEquals(1000, cache.size());
        cache.clear();
        assertEquals(0, cache.size());
View Full Code Here

        Cache cache = newCache(1000 * 60, 1000);

        for (int i = 0; i < 10000; i++)
        {
            cache.addObject("k-" + (i % 500), "v-" + i);
        }

        assertEquals(500, cache.size());
        cache.clear();
        assertEquals(0, cache.size());
View Full Code Here

        Cache cache = newCache(1000 * 60, 500);

        for (int i = 0; i < 1000; i++)
        {
            cache.addObject("k-" + i, "v-" + i);
        }

        assertEquals(500, cache.size());

        for (int i = 0; i < 10000; i++)
View Full Code Here

    {

        Cache  cache = newCache(1000 * 60, 1000);
        String key   = null;

        cache.addObject("k-0", "v-0");

        for (int i = 0; i < 10000; i++)
        {
            key = "k-" + (i % 200);

View Full Code Here

        for (int i = 0; i < 10000; i++)
        {
            key = "k-" + (i % 200);

            cache.addObject(key, "v-" + i);
            assertNotNull(key, cache.getObject(key));
        }

        assertEquals(200, cache.size());
    }
View Full Code Here

    public void test1Put10000GetsSameKey2Puts()
    {

        Cache cache = newCache(1000 * 60, 2);

        cache.addObject("x", "x");
        cache.addObject("y", "y");

        for (int i = 0; i < 10000; i++)
        {
            assertNotNull(cache.getObject("x"));
View Full Code Here

    {

        Cache cache = newCache(1000 * 60, 2);

        cache.addObject("x", "x");
        cache.addObject("y", "y");

        for (int i = 0; i < 10000; i++)
        {
            assertNotNull(cache.getObject("x"));
            assertNotNull(cache.getObject("y"));
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.