Examples of CacheManager


Examples of javax.cache.CacheManager

        try {
            PrivilegedCarbonContext.startTenantFlow();
            PrivilegedCarbonContext cc = PrivilegedCarbonContext.getThreadLocalCarbonContext();
            cc.setTenantDomain("apple.com");
            cc.setTenantId(1);
            CacheManager cacheManager = Caching.getCacheManagerFactory().getCacheManager("test");
            String cacheName = "testCreateExistingCache";
            cacheManager.<String, Integer>createCacheBuilder(cacheName).
                    setExpiry(CacheConfiguration.ExpiryType.MODIFIED,
                              new CacheConfiguration.Duration(TimeUnit.SECONDS, 10)).
                    setStoreByValue(false).build();
            cacheManager.<String, Integer>createCacheBuilder(cacheName).
                    setExpiry(CacheConfiguration.ExpiryType.MODIFIED,
                              new CacheConfiguration.Duration(TimeUnit.SECONDS, 10)).
                    setStoreByValue(false).build();
        } finally {
            PrivilegedCarbonContext.endTenantFlow();
View Full Code Here

Examples of javax.cache.CacheManager

        try {
            PrivilegedCarbonContext.startTenantFlow();
            PrivilegedCarbonContext cc = PrivilegedCarbonContext.getThreadLocalCarbonContext();
            cc.setTenantDomain("bikes.com");
            cc.setTenantId(1);
            CacheManager cacheManager = Caching.getCacheManagerFactory().getCacheManager("test");
            String cacheName = "testCacheLoaderForTenants";
            Cache<String, String> cache =
                    cacheManager.<String, String>createCacheBuilder(cacheName).
                            setCacheLoader(new TestCacheLoader<String, String>()).build();
            Future<String> future = cache.load("key1");
            while (!future.isDone()) {
                try {
                    Thread.sleep(1);
View Full Code Here

Examples of javax.cache.CacheManager

        // CacheManager cacheManager = Caching.getCacheManager(); // same as Caching.getCacheManagerFactory().getCacheManager("__default__");

        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain("foo.com");
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(1);

        CacheManager cacheManager = Caching.getCacheManagerFactory().getCacheManager("test");
        cache = cacheManager.getCache(cacheName);
    }
View Full Code Here

Examples of javax.cache.CacheManager

    @Test(groups = {"org.wso2.carbon.clustering.hazelcast.jsr107"},
          description = "")
    public void checkMultipleCacheManagers() {
        String cacheName = "sampleCache";
        CacheManager cacheManager1 = Caching.getCacheManagerFactory().getCacheManager("test-1");
        Cache<String, Integer> cache1 = cacheManager1.getCache(cacheName);
        int value1 = 9876;
        cache1.put(key, value1);

        CacheManager cacheManager2 = Caching.getCacheManagerFactory().getCacheManager("test-2");
        Cache<String, String> cache2 = cacheManager2.getCache(cacheName);
        String value2 = "Afkham Azeez";
        cache2.put(key, value2);


        assertEquals(cache1.get(key).intValue(), value1);
View Full Code Here

Examples of javax.cache.CacheManager

    }

    @Test(groups = {"org.wso2.carbon.clustering.hazelcast.jsr107"},
          description = "")
    public void checkMultipleCaches() {
        CacheManager cacheManager = Caching.getCacheManagerFactory().getCacheManager("test-1");
        Cache<String, Integer> cache1 = cacheManager.getCache("sampleCache1");
        Cache<String, String> cache2 = cacheManager.getCache("sampleCache2");

        int value1 = 9876;
        String value2 = "Afkham Azeez";
        cache1.put(key, value1);
        cache2.put(key, value2);
View Full Code Here

Examples of javax.cache.CacheManager

    }

    @Test(groups = {"org.wso2.carbon.clustering.hazelcast.jsr107"},
          description = "")
    public void checkWithCustomCacheConfiguration() {
        CacheManager cacheManager = Caching.getCacheManagerFactory().getCacheManager("test");
        String cacheName = "cacheXXX";
        cache = cacheManager.<String, Integer>createCacheBuilder(cacheName).
                setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, 10)).
                setStoreByValue(false).build();
        int value = 9876;
        cache.put(key, value);
        assertEquals(cache.get(key).intValue(), value);
View Full Code Here

Examples of net.sf.ehcache.CacheManager

    private net.sf.ehcache.Cache cache;

    public EHCacheCache(String name) throws Exception
    {

        CacheManager cacheManager = CacheManager.getInstance();

        cache = cacheManager.getCache(name);

        if (cache == null)
        {
            cacheManager.addCache(name);

            cache = cacheManager.getCache(name);
        }
    }
View Full Code Here

Examples of net.sf.ehcache.CacheManager

    {
      manager = CacheManager.getInstance();
    }
    else
    {
      manager = new CacheManager();
    }

    cacheManager = new GlobalCacheManager();
    if (manager.cacheExists(CACHE_NAME) == false)
    {
View Full Code Here

Examples of net.sf.ehcache.CacheManager

        super(name);
    }

    public void setUp() throws Exception
    {
        _cacheManager = new CacheManager();

        super.setUp();
    }
View Full Code Here

Examples of net.sf.ehcache.CacheManager

            String configurationResourceName = null;
            if (properties != null) {
                configurationResourceName = (String) properties.get( Environment.CACHE_PROVIDER_CONFIG );
            }
            if ( StringHelper.isEmpty( configurationResourceName ) ) {
                manager = new CacheManager();
            } else {
                URL url = loadResource(configurationResourceName);
                manager = new CacheManager(url);
            }

            // Register statistics MBean of EHCache on the current MBean server
            log.info("registering EHCache monitoring MBean");
            MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
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.