Package com.volantis.cache

Examples of com.volantis.cache.CacheBuilder


                enabled = false;
                maxEntries = 0;
            }
        }
        if (enabled) {
            final CacheBuilder cacheBuilder =
                CacheFactory.getDefaultInstance().createCacheBuilder();
            cacheBuilder.setMaxCount(maxEntries);
            final SystemClock clock = SystemClock.getDefaultInstance();
            cacheBuilder.setClock(clock);
            cacheBuilder.setExpirationChecker(
                new URLContentValidationChecker());
            cache = cacheBuilder.buildCache();
        } else {
            cache = null;
        }
        cacheInitialized = true;
    }
View Full Code Here


    private URLContentManager createURLContentManager(final SystemClock clock,
            final Period timeout, final boolean cacheable, final int maxCount) {

        Cache cache = null;
        if (cacheable) {
            final CacheBuilder cacheBuilder =
                CacheFactory.getDefaultInstance().createCacheBuilder();
            cacheBuilder.setMaxCount(maxCount);
            cacheBuilder.setClock(clock);
            cacheBuilder.setExpirationChecker(new URLContentValidationChecker());
            cache = cacheBuilder.buildCache();
        }

        final URLContentManagerConfiguration config =
            new URLContentManagerConfiguration();
        config.setDefaultTimeout(timeout);
View Full Code Here

        //   Test Expectations
        // =====================================================================

        CacheableObjectProvider objectProvider = new TestCacheableObjectProvider();

        CacheBuilder builder = new CacheBuilderImpl();
        builder.setObjectProvider(objectProvider);
        builder.setMaxCount(8);
        Cache cache = builder.buildCache();

        GroupBuilder groupBuilder = new GroupBuilderImpl();
        groupBuilder.setMaxCount(4);
        Group root = cache.getRootGroup();
        root.addRemovalListener(listenerRootMock);
View Full Code Here

            }
        }

        Cache cache;
        synchronized (caches) {
            CacheBuilder cacheBuilder = CACHE_FACTORY.createCacheBuilder();
            cacheBuilder.setMaxCount(maxCount);
            cacheBuilder.setExpirationChecker(EXPIRATION_CHECKER);
            cache = cacheBuilder.buildCache();
            caches.put(name, cache);
        }

        final Period ttl;
        if ("unlimited".equals(maxAge)) {
View Full Code Here

            totalSize = Integer.MAX_VALUE;
        } else {
            totalSize = localSize + remoteSize;
        }

        CacheBuilder builder = factory.createCacheBuilder();
        builder.setMaxCount(totalSize);
        builder.setExpirationChecker(new PolicyExpirationChecker());
        builder.setClock(clock);
        cache = builder.buildCache();

        Group root = getRootGroup();

        GroupBuilder groupBuilder;
View Full Code Here

TOP

Related Classes of com.volantis.cache.CacheBuilder

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.