Package javax.util.jcache

Examples of javax.util.jcache.CacheAccessFactory


            ca.setDiskPath(System.getProperty("java.io.tmpdir"));
            ca.setDiskCacheSize(1000);
            ca.setMemoryCacheSize(10);
            ca.setMaxObjects(10000);
            ca.setLocal();
            CacheAccessFactory factory = CacheAccessFactory.getInstance();
            javax.util.jcache.Cache cache = factory.getCache();
            cache.close();
            cache.init(ca);
            System.out.println(ca.toString());
            Map cacheMap = factory.getMapAccess();
            long startTime = System.currentTimeMillis();
            System.out.println("writing 25,000 values");
            for (int loop = 0; loop < 25000; loop++) {
                String key = "Key:" + loop;
                String value = "Value:" + loop;
View Full Code Here


import junit.framework.TestCase;
import org.fjank.jcache.CacheSweeper;

public class Bug1037611 extends TestCase {
    public void testResetCache() throws Exception {
        CacheAccessFactory factory = CacheAccessFactory.getInstance();
        CacheAttributes catt = CacheAttributes.getDefaultCacheAttributes();
        catt.setLocal();
        catt.setCleanInterval(1);
        Cache cache = factory.getCache(false);
        //
        cache.init(catt);
        //        CacheSweeper.startSweeper executes
        //        within CacheSweeper.getInstance
        //
        CacheSweeper instance = CacheSweeper.getInstance();
       
        cache.close();
        //        CacheSweeper.stopSweeper executes
        //
        cache = factory.getCache(false);
        //
        cache.init(catt);
        CacheSweeper instance2= CacheSweeper.getInstance();
        assertNotSame(instance, instance2);
        //        CacheSweeper.startSweeper does not
View Full Code Here

   */
    final public void testSetMaxObjects() throws Exception {
        CacheAttributes ca = CacheAttributes.getDefaultCacheAttributes();
        ca.setMaxObjects(5);
        ca.setLocal();
        CacheAccessFactory factory = CacheAccessFactory.getInstance();
        Cache cache = factory.getCache();
        cache.close();
        cache.init(ca);
        Map map = factory.getMapAccess();
        int max=5;
        for(int i=0; i<max; i++) {
            map.put(""+i, new Object());
        }
        //now it should be full.
View Full Code Here

        return testMap;
    }

    private void initJCacheMap()  {
        try {
            CacheAccessFactory factory = CacheAccessFactory.getInstance();
            Cache cache = factory.getCache(false);
            CacheAttributes attributes = CacheAttributes.getDefaultCacheAttributes();
            attributes.setLocal();
            attributes.setMaxObjects(100000000);
            cache.init(attributes);
            this.jcache= factory.getMapAccess();
        } catch (CacheNotAvailableException e) {
            throw new IllegalStateException(e.getMessage());
        } catch (CacheException e) {
            throw new IllegalStateException(e.getMessage());
        }
View Full Code Here

            ca.setDiskPath(System.getProperty("java.io.tmpdir"));
            ca.setDiskCacheSize(1000);
            ca.setMemoryCacheSize(10);
            ca.setMaxObjects(25000);
            ca.setLocal();
            CacheAccessFactory factory = CacheAccessFactory.getInstance();
            javax.util.jcache.Cache cache = factory.getCache();
            cache.close();
            cache.init(ca);
            System.out.println(ca.toString());
            Map cacheMap = factory.getMapAccess();
            long startTime = System.currentTimeMillis();
            System.out.println("writing 250,000 values");
            Map map = new HashMap();
            try {
                Thread.sleep(5000);
View Full Code Here

TOP

Related Classes of javax.util.jcache.CacheAccessFactory

Copyright © 2018 www.massapicom. 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.