Package org.apache.cocoon.pipeline.caching

Examples of org.apache.cocoon.pipeline.caching.CacheValue


        // construct the current cache key
        this.cacheKey = this.constructCacheKey();

        // check for a cached value first
        CacheValue cachedValue = this.getCachedValue(this.cacheKey);
        if (cachedValue != null) {
            // cached value found -> write it
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("Write cache value to output stream: " + cachedValue);
            }
            cachedValue.writeTo(this.cachingOutputStream.getOutputStream());

            if (!this.isCacheKeyValid(cachedValue)) {
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Cached value is not up to date. Delegating to " + this.cacheRefreshManager);
                }
View Full Code Here


        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Used cache: " + this.cache);
        }

        // checked for a cached value first
        CacheValue cachedValue = this.getCachedValue(this.cacheKey);
        if (this.isCacheKeyValid(cachedValue)) {
            // cached value found
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("Write cache value to output stream: " + cachedValue);
            }

            cachedValue.writeTo(this.cachingOutputStream.getOutputStream());
            return;
        }

        // execute the pipeline
        this.invokeStarter();
View Full Code Here

        if (this.cache == null) {
            this.logger.warn("Caching pipeline has no cache configured. Falling back to non-caching behavior.");
            return null;
        }

        CacheValue cacheValue = this.cache.get(cacheKey, true);
        if (this.logger.isDebugEnabled()) {
            if (cacheValue != null) {
                this.logger.debug("Retrieved content from cache: " + cacheValue);
            } else {
                this.logger.debug("No cache value available for " + cacheKey);
View Full Code Here

     */
    @ManagedOperation(description = "Returns size of this cache")
    public final String size() {
        double result = 0;
        for (CacheKey key : this.cache.keySet()) {
            CacheValue cacheValue = this.cache.get(key);
            if (cacheValue != null) { // prevent from NullPointerException
                double size = cacheValue.size();
                if (size != -1) {
                    result += size;
                }
            }
        }
View Full Code Here

        int points = this.countPoints(minSize, maxSize, minLastModify, maxLastModify, minExpires, maxExpires);

        for (Cache cache : this.caches) {
            for (CacheKey cacheKey : cache.keySet()) {
                int score = 0;
                CacheValue cacheValue = cache.get(cacheKey);
                if (cacheValue == null) { // prevent from NullPointerException
                    continue;
                }

                // check minSize condition
                if (minSize >= 0 && cacheValue.size() >= minSize) {
                    // if minSize condition is set (it value is < 0) and it is not fulfilled we skip this element
                    score++;
                }

                // check maxSize condition
                if (maxSize >= 0 && cacheValue.size() <= maxSize) {
                    score++;
                }

                Date lastModifyDate = new Date(cacheKey.getLastModified());
                if (minLastModify != null && lastModifyDate.compareTo(minLastModify) >= 0) {
View Full Code Here

        // construct the current cache key
        this.cacheKey = this.constructCacheKey();

        // check for a cached value first
        CacheValue cachedValue = this.getCachedValue(this.cacheKey);
        if (cachedValue != null) {
            // cached value found -> write it
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("Write cache value to output stream: " + cachedValue);
            }
            cachedValue.writeTo(this.cachingOutputStream.getOutputStream());

            if (!cachedValue.isValid(this.cacheKey)) {
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Cached value is not up to date. Delegating to " + this.cacheRefreshManager);
                }
                // the cached value is not valid -> refresh the value
                this.cacheRefreshManager.refreshCacheValue(this.cacheKey, this);
View Full Code Here

            this.logger.debug("Used cache: " + this.pipelineCache);
        }

        this.cacheKey = this.constructCacheKey();
        // checked for a cached value first
        CacheValue cachedValue = this.getCachedValue(this.cacheKey);
        if (cachedValue != null && cachedValue.isValid(this.cacheKey)) {
            // cached value found
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("Write cache value to output stream: " + cachedValue);
            }

            cachedValue.writeTo(this.cachingOutputStream.getOutputStream());
            return;
        }

        // execute the pipeline
        this.invokeStarter();
View Full Code Here

    protected CacheValue getCachedValue(CacheKey cacheKey) {
        if (cacheKey == null) {
            return null;
        }

        CacheValue cacheValue = this.pipelineCache.get(cacheKey);
        if (this.logger.isDebugEnabled()) {
            if (cacheValue != null) {
                this.logger.debug("Retrieved content from cache: " + cacheValue);
            } else {
                this.logger.debug("No cache value available for " + cacheKey);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.pipeline.caching.CacheValue

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.