Examples of UtilCache


Examples of org.ofbiz.base.util.cache.UtilCache

        this.dispatcher = dispatcher;
        this.order = order;
        this.locale = locale;
        this.mimeTypeId = mimeTypeId;
        if (orderContentCache == null) {
            orderContentCache = new UtilCache("order.content", true);     // use soft reference to free up memory if needed
        }
    }
View Full Code Here

Examples of org.ofbiz.base.util.cache.UtilCache

        this.dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
        this.order = order;
        this.locale = UtilHttp.getLocale(request);
        this.mimeTypeId = "text/html";
        if (orderContentCache == null) {
            orderContentCache = new UtilCache("order.content", true);     // use soft reference to free up memory if needed
        }
    }
View Full Code Here

Examples of org.ofbiz.base.util.cache.UtilCache

            number = Integer.parseInt(numString);
        } catch (Exception e) {
            return "error";
        }

        UtilCache utilCache = UtilCache.findCache(name);

        if (utilCache != null) {
            Object key = null;

            if (utilCache.getMaxSize() > 0) {
                try {
                    key = utilCache.cacheLineTable.getKeyFromMemory(number);
                } catch (Exception e) {}
            } else {
                // no LRU, try looping through the keySet to see if we find the specified index...
                Iterator ksIter = utilCache.cacheLineTable.keySet().iterator();
                int curNum = 0;

                while (ksIter.hasNext()) {
                    if (number == curNum) {
                        key = ksIter.next();
                        break;
                    } else {
                        ksIter.next();
                    }
                    curNum++;
                }
            }

            if (key != null) {
                utilCache.remove(key);
                errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCache.removeElementWithKey", UtilMisc.toMap("key", key.toString()), locale) + ".";
                request.setAttribute("_EVENT_MESSAGE_", errMsg);
            } else {
                errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCache.couldNotRemoveElementNumber", UtilMisc.toMap("name", name, "numString", numString), locale) + ".";
                request.setAttribute("_ERROR_MESSAGE_", errMsg);
View Full Code Here

Examples of org.ofbiz.base.util.cache.UtilCache

        if (name == null) {
            errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCache.couldNotClearCache", locale) + ".";
            request.setAttribute("_ERROR_MESSAGE_", errMsg);
            return "error";
        }
        UtilCache utilCache = UtilCache.findCache(name);

        if (utilCache != null) {
            utilCache.clear();
            errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCache.clearCache", UtilMisc.toMap("name", name), locale) + ".";
            request.setAttribute("_EVENT_MESSAGE_", errMsg);
        } else {
            errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCache.couldNotClearCacheNotFoundName", UtilMisc.toMap("name", name), locale) + ".";
            request.setAttribute("_ERROR_MESSAGE_", errMsg);
View Full Code Here

Examples of org.ofbiz.base.util.cache.UtilCache

        } catch (Exception e) {}
        try {
            expireTime = Long.valueOf(expireTimeStr);
        } catch (Exception e) {}

        UtilCache utilCache = UtilCache.findCache(name);

        if (utilCache != null) {
            if (maxSize != null)
                utilCache.setMaxSize(maxSize.intValue());
            if (expireTime != null)
                utilCache.setExpireTime(expireTime.longValue());
            if (useSoftReferenceStr != null) {
                utilCache.setUseSoftReference("true".equals(useSoftReferenceStr));
            }
        }
        return "success";
    }
View Full Code Here

Examples of org.ofbiz.base.util.cache.UtilCache

    public ScreenCache() {
        super("screen");
    }

    public GenericWidgetOutput get(String screenName, WidgetContextCacheKey wcck) {
        UtilCache screenCache = getCache(screenName);
        if (screenCache == null) return null;
        return (GenericWidgetOutput) screenCache.get(wcck);
    }
View Full Code Here

Examples of org.ofbiz.base.util.cache.UtilCache

        UtilCache<WidgetContextCacheKey, GenericWidgetOutput> screenCache = getOrCreateCache(screenName);
        return screenCache.put(wcck, output);
    }

    public GenericWidgetOutput remove(String screenName, WidgetContextCacheKey wcck) {
        UtilCache screenCache = getCache(screenName);
        if (Debug.verboseOn()) Debug.logVerbose("Removing from ScreenCache with key [" + wcck + "], will remove from this cache: " + (screenCache == null ? "[No cache found to remove from]" : screenCache.getName()), module);
        if (screenCache == null) return null;
        GenericWidgetOutput retVal = (GenericWidgetOutput) screenCache.remove(wcck);
        if (Debug.verboseOn()) Debug.logVerbose("Removing from ScreenCache with key [" + wcck + "], found this in the cache: " + retVal, module);
        return retVal;
    }
View Full Code Here

Examples of org.ofbiz.base.util.cache.UtilCache

    }

    public static Map<String, Object> clearContentAssocViewCache(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{
        Map results = FastMap.newInstance();

        UtilCache utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewFrom");

        if (utilCache != null) {
            utilCache.clear();
        }

        utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewTo");
        if (utilCache != null) {
            utilCache.clear();
        }

        return results;
    }
View Full Code Here

Examples of org.ofbiz.base.util.cache.UtilCache

    public static Map<String, Object> clearContentAssocDataResourceViewCache(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{

        Map results = FastMap.newInstance();

        UtilCache utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewDataResourceFrom");
        if (utilCache != null) {
            utilCache.clear();
        }

        utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewDataResourceTo");
        if (utilCache != null) {
            utilCache.clear();
        }

        return results;
    }
View Full Code Here

Examples of org.ofbiz.base.util.cache.UtilCache

    }

    public static Map<String, Object> clearContentAssocViewCache(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{
        Map results = FastMap.newInstance();

        UtilCache utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewFrom");

        if (utilCache != null) {
            utilCache.clear();
        }

        utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewTo");
        if (utilCache != null) {
            utilCache.clear();
        }

        return results;
    }
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.