Examples of MapCache


Examples of org.apache.shiro.cache.MapCache

        SessionDAO sessionDAO = ((DefaultSessionManager) ((DefaultSecurityManager) sm).getSessionManager()).getSessionDAO();
        assertTrue(sessionDAO instanceof EnterpriseCacheSessionDAO);
        CachingSessionDAO cachingSessionDAO = (CachingSessionDAO) sessionDAO;
        Cache activeSessionsCache = cachingSessionDAO.getActiveSessionsCache();
        assertTrue(activeSessionsCache instanceof MapCache);
        MapCache mapCache = (MapCache) activeSessionsCache;

        //this is the line that verifies Caches created by our specific CacheManager are not overwritten by the
        //default cache manager's caches:
        assertTrue(mapCache instanceof HashMapCacheManager.HashMapCache);
    }
View Full Code Here

Examples of org.apache.shiro.cache.MapCache

        SessionDAO sessionDAO = ((DefaultSessionManager) ((DefaultSecurityManager) sm).getSessionManager()).getSessionDAO();
        assertTrue(sessionDAO instanceof EnterpriseCacheSessionDAO);
        CachingSessionDAO cachingSessionDAO = (CachingSessionDAO) sessionDAO;
        Cache activeSessionsCache = cachingSessionDAO.getActiveSessionsCache();
        assertTrue(activeSessionsCache instanceof MapCache);
        MapCache mapCache = (MapCache) activeSessionsCache;

        //this is the line that verifies Caches created by our specific CacheManager are not overwritten by the
        //default cache manager's caches:
        assertTrue(mapCache instanceof HashMapCacheManager.HashMapCache);
    }
View Full Code Here

Examples of org.dspace.services.caching.model.MapCache

        if (cacheName == null || "".equals(cacheName)) {
            throw new IllegalArgumentException("String cacheName must not be null or empty!");
        }

        // check for existing cache
        MapCache cache = null;
        CacheScope scope = CacheScope.REQUEST;
        if (cacheConfig != null) {
            scope = cacheConfig.getCacheScope();
        }

        Map<String, MapCache> caches = getRequestCaches();
        if (caches != null) {
            if (CacheScope.REQUEST.equals(scope)) {
                cache = caches.get(cacheName);
            }

            if (cache == null) {
                cache = new MapCache(cacheName, cacheConfig);
                // place cache into the right TL
                if (CacheScope.REQUEST.equals(scope)) {
                    caches.put(cacheName, cache);
                }
            }
View Full Code Here

Examples of org.dspace.services.caching.model.MapCache

     */
    @Test
    public void testInstantiateMapCache() {
        requestService.startRequest();

        MapCache cache = cachingService.instantiateMapCache("aaronz-map", null);
        assertNotNull(cache);
        assertEquals("aaronz-map", cache.getName());
        assertNotNull(cache.getCache());
        assertEquals(0, cache.size());
        assertNotNull(cache.getConfig());
        assertEquals(cache.getConfig().getCacheScope(), CacheScope.REQUEST);

        MapCache cache2 = cachingService.instantiateMapCache("aaronz-map", null);
        assertNotNull(cache2);
        assertEquals(cache2, cache);

        requestService.endRequest(null);
       
View Full Code Here

Examples of org.shiftone.cache.adaptor.MapCache

{

    public void testSimple() throws Exception
    {

        Cache cache1 = new MapCache(new Hashtable());
        Cache cache2 = new SoftCache(cache1);

        cache2.addObject("key", "value");
        assertEquals("value", cache2.getObject("key"));
    }
View Full Code Here

Examples of org.shiftone.cache.adaptor.MapCache

    public void testReference() throws Exception
    {

        Object    inObject = createBigObject();
        Object    outObject;
        MapCache  mapCache;
        SoftCache softCache;

        mapCache  = new MapCache(new Hashtable());
        softCache = new SoftCache(mapCache);

        softCache.addObject("key", inObject);

        outObject = mapCache.getObject("key");

        assertTrue("outObject instanceof Reference", outObject instanceof Reference);
        assertTrue("cache2.getObject('key') == inObject", softCache.getObject("key") == inObject);

        outObject = null;
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.