Package org.castor.cache

Examples of org.castor.cache.Cache.initialize()


        try {
            Properties params = new Properties();
            params.put(Cache.PARAM_NAME, "dummy");
            params.put(TimeLimited.PARAM_TTL, "5");
            cache.initialize(params);
        } catch (CacheAcquireException ex) {
            fail("Unexpected CacheAcquireException at initialization.");
        }

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


        assertEquals("fifo", cache.getType());

        Properties params = new Properties();
        params.put(Cache.PARAM_NAME, "dummy1");
        try {
            cache.initialize(params);
        } catch (CacheAcquireException ex) {
            fail("Failed to initialize FIFOHashbelt instance");
        }

        assertFalse(cache.containsKey("first key"));
View Full Code Here

    private Cache initialize() throws CacheAcquireException {
        Cache cache = new FIFOHashbelt();
        Properties params = new Properties();
        params.put(Cache.PARAM_NAME, "dummy1");
        cache.initialize(params);

        assertNull(cache.put("first key", "first value"));
        assertNull(cache.put("second key", "second value"));
        assertNull(cache.put("third key", "third value"));
       
View Full Code Here

        assertEquals("lru", cache.getType());

        Properties params = new Properties();
        params.put(Cache.PARAM_NAME, "dummy1");
        try {
            cache.initialize(params);
        } catch (CacheAcquireException ex) {
            fail("Failed to initialize LRUHashbelt instance");
        }

        assertFalse(cache.containsKey("first key"));
View Full Code Here

    private Cache initialize() throws CacheAcquireException {
        Cache cache = new LRUHashbelt();
        Properties params = new Properties();
        params.put(Cache.PARAM_NAME, "dummy1");
        cache.initialize(params);

        assertNull(cache.put("first key", "first value"));
        assertNull(cache.put("second key", "second value"));
        assertNull(cache.put("third key", "third value"));
       
View Full Code Here

        assertEquals(30, ((TimeLimited) cache).getTTL());
        assertEquals(Cache.DEFAULT_NAME, cache.getName());
       
        Properties params = new Properties();
        params.put(Cache.PARAM_NAME, "dummy1");
        cache.initialize(params);
        assertEquals(30, ((TimeLimited) cache).getTTL());
        assertEquals("dummy1", cache.getName());
       
        params.clear();
        params.put(Cache.PARAM_NAME, "dummy2");
View Full Code Here

        assertEquals("dummy1", cache.getName());
       
        params.clear();
        params.put(Cache.PARAM_NAME, "dummy2");
        params.put(TimeLimited.PARAM_TTL, "-10");
        cache.initialize(params);
        assertEquals(30, ((TimeLimited) cache).getTTL());
        assertEquals("dummy2", cache.getName());
       
        params.clear();
        params.put(Cache.PARAM_NAME, "dummy3");
View Full Code Here

        assertEquals("dummy2", cache.getName());
       
        params.clear();
        params.put(Cache.PARAM_NAME, "dummy3");
        params.put(TimeLimited.PARAM_TTL, "0");
        cache.initialize(params);
        assertEquals(30, ((TimeLimited) cache).getTTL());
        assertEquals("dummy3", cache.getName());
       
        params.clear();
        params.put(Cache.PARAM_NAME, "dummy4");
View Full Code Here

        assertEquals("dummy3", cache.getName());
       
        params.clear();
        params.put(Cache.PARAM_NAME, "dummy4");
        params.put(TimeLimited.PARAM_TTL, "10");
        cache.initialize(params);
        assertEquals(10, ((TimeLimited) cache).getTTL());
        assertEquals("dummy4", cache.getName());
       
        assertFalse(cache.containsKey("first key"));
        assertFalse(cache.containsKey("second key"));
View Full Code Here

        try {
            Properties params = new Properties();
            params.put(Cache.PARAM_NAME, "dummy");
            params.put(TimeLimited.PARAM_TTL, new Integer(10));
            cache.initialize(params);
        } catch (CacheAcquireException ex) {
            fail("Unexpected CacheAcquireException at initialization.");
        }
       
        assertNull(cache.put("first key", "first value"));
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.