Package org.dspace.services.model

Examples of org.dspace.services.model.CacheConfig


        }
        this.cache = cache;
        if (cacheConfig != null) {
            this.cacheConfig = cacheConfig;
        } else {
            this.cacheConfig = new CacheConfig(CacheScope.INSTANCE);
        }
    }
View Full Code Here


     */
    public void queueEvent(Event event) {
        validateEvent(event);

        // get the cache
        Cache queueCache = this.cachingService.getCache(QUEUE_CACHE_NAME, new CacheConfig(CacheScope.REQUEST));

        // put the event in the queue if this is in a request
        if (requestService.getCurrentRequestId() != null) {
            // create a key which is orderable and unique
            String key = System.currentTimeMillis() + ":" + queueCache.size() + ":" + event.getId();
View Full Code Here

     *
     * @return the number of events which were fired
     */
    protected int fireQueuedEvents() {
        int fired = 0;
        Cache queueCache = this.cachingService.getCache(QUEUE_CACHE_NAME, new CacheConfig(CacheScope.REQUEST));

        List<String> eventIds = queueCache.getKeys();
        Collections.sort(eventIds); // put it in the order they were added (hopefully)
        if (eventIds.size() > 0) {
            for (String eventId : eventIds) {
View Full Code Here

     * Clears all events for the current request.
     *
     * @return the number of events that were cleared
     */
    protected int clearQueuedEvents() {
        Cache queueCache = this.cachingService.getCache(QUEUE_CACHE_NAME, new CacheConfig(CacheScope.REQUEST));
        int cleared = queueCache.size();
        queueCache.clear();
        return cleared;
    }
View Full Code Here

        this.name = name;
        this.cache = new HashMap<String, Object>();
        if (cacheConfig != null) {
            this.cacheConfig = cacheConfig;
        } else {
            this.cacheConfig = new CacheConfig(CacheScope.REQUEST);
        }
    }
View Full Code Here

    @BeforeClass
    public static void initClass() {
        CachingServiceImpl cachingService = getService(CachingServiceImpl.class);
        cacheManager = cachingService.getCacheManager();
        cache = cachingService.getCache(cacheName, new CacheConfig(CacheScope.INSTANCE));
    }
View Full Code Here

    public void testEhcacheCache() {
        cacheManager.addCache("org.dspace.ehcache");
        Ehcache ehcache = cacheManager.getEhcache("org.dspace.ehcache");
        assertNotNull(ehcache);

        EhcacheCache cache = new EhcacheCache(ehcache, new CacheConfig(CacheScope.INSTANCE));
        assertEquals("org.dspace.ehcache", cache.getName());
       
        //trash the references
        ehcache = null;
        cache = null;
View Full Code Here

    /**
     * Test method for {@link org.dspace.services.caching.model.EhcacheCache#getConfig()}.
     */
    @Test
    public void testGetConfig() {
        CacheConfig cacheConfig = cache.getConfig();
        assertNotNull(cacheConfig);
       
        cacheConfig = null;
    }
View Full Code Here

   
    /**
     * @return the request storage cache
     */
    private Cache getRequestCache() {
        return cachingService.getCache(CachingService.REQUEST_CACHE, new CacheConfig(CacheScope.REQUEST));
    }
View Full Code Here

        assertEquals(CacheScope.INSTANCE, c1.getConfig().getCacheScope());
        assertTrue(c1 instanceof EhcacheCache);

        requestService.startRequest();

        Cache rc1 = cachingService.getCache("org.dspace.request.cache1", new CacheConfig(CacheScope.REQUEST));
        assertNotNull(rc1);
        assertEquals("org.dspace.request.cache1", rc1.getName());
        assertEquals(CacheScope.REQUEST, rc1.getConfig().getCacheScope());
        assertTrue(rc1 instanceof MapCache);
View Full Code Here

TOP

Related Classes of org.dspace.services.model.CacheConfig

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.