Package org.apache.olio.webapp.cache

Examples of org.apache.olio.webapp.cache.Cache


        queryMap.put("day", day);
        queryMap.put("month", month);
        queryMap.put("year", year);
        queryMap.put("orderBy", orderBy);

        Cache cache = WebappUtil.getCache();
        if (cache != null) {
            String cacheKey = WebappUtil.getCacheKey("/event/list", queryMap);
            if (cacheKey != null) {

                Object cobj = null;

                CachedList cl = (CachedList)cache.get(cacheKey);

                if (cl == null) {
                    // nothing in cache
                    cl = new CachedList(cacheKey);

                    // get a new cacheable page/partial
                    cobj = createCachePageObject(queryMap, response, request, mf);
                    cl.put(index, cobj);


                    if (cache.needsRefresh(false, cacheKey)) {
                        cache.put(cacheKey, cl, CacheFactory.getInstance().getCacheExpireInSeconds());
                        cache.doneRefresh(cacheKey, CacheFactory.getInstance().getCacheLockExpireInSeconds());
                    }

                } else {
                    // something in the cache
                    cobj = cl.get(index); // we are using this whatever

                    Object newCobj = createCachePageObject(queryMap, response, request, mf);
                    cl.put(index, newCobj); // replaces existing value
                     if (cache.needsRefresh(true, cacheKey)) {
                        cache.put(cacheKey, cl, CacheFactory.getInstance().getCacheExpireInSeconds());
                        cache.doneRefresh(cacheKey, CacheFactory.getInstance().getCacheLockExpireInSeconds());
                    }
                }

                if (cobj != null) {
                    request.setAttribute("content", cobj);
View Full Code Here

TOP

Related Classes of org.apache.olio.webapp.cache.Cache

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.