Examples of ExpiringCacheEntry


Examples of org.apache.roller.weblogger.util.cache.ExpiringCacheEntry

            if (lastModified == null) {
                lastModified = new Date();
                log.warn("Can't get lastUpdate time, using current time instead");
            }
           
            this.lastUpdateTime = new ExpiringCacheEntry(lastModified, this.timeout);
        }
       
        return lastModified;
    }
View Full Code Here

Examples of org.apache.roller.weblogger.util.cache.ExpiringCacheEntry

   
    public Object get(String key) {
       
        Object entry = null;
       
        ExpiringCacheEntry lazyEntry =
                (ExpiringCacheEntry) this.contentCache.get(key);
        if(lazyEntry != null) {
            entry = lazyEntry.getValue();
            if(entry != null) {
                log.debug("HIT "+key);
            } else {
                log.debug("HIT-EXPIRED "+key);
            }
View Full Code Here

Examples of org.apache.roller.weblogger.util.cache.ExpiringCacheEntry

    }
   
   
    public void put(String key, Object value) {
    // expire after 60 minutes
        contentCache.put(key, new ExpiringCacheEntry(value, 60 * 60 * 1000));
        log.debug("PUT "+key);
    }
View Full Code Here

Examples of org.apache.roller.weblogger.util.cache.ExpiringCacheEntry

        }
       
        // still null, we need to get a fresh value
        if(lastModified == null) {
            lastModified = new Date();
            this.lastUpdateTime = new ExpiringCacheEntry(lastModified, this.timeout);
        }
       
        return lastModified;
    }
View Full Code Here

Examples of org.apache.roller.weblogger.util.cache.ExpiringCacheEntry

            if (lastModified == null) {
                lastModified = new Date();
                log.warn("Can't get lastUpdate time, using current time instead");
            }
           
            this.lastUpdateTime = new ExpiringCacheEntry(lastModified, this.timeout);
        }
       
        return lastModified;
    }
View Full Code Here

Examples of org.apache.roller.weblogger.util.cache.ExpiringCacheEntry

            return false;
        }
       
        // see if we have any info about this client yet
        ClientInfo client = null;
        ExpiringCacheEntry cacheEntry = (ExpiringCacheEntry) this.clientHistoryCache.get(clientId);
        if(cacheEntry != null) {
            log.debug("HIT "+clientId);
            client = (ClientInfo) cacheEntry.getValue();
           
            // this means entry had expired
            if(client == null) {
                log.debug("EXPIRED "+clientId);
                this.clientHistoryCache.remove(clientId);
            }
        }
       
        // if we already know this client then update their hit count and
        // see if they have surpassed the threshold
        if(client != null) {
            client.hits++;
           
            log.debug("STATUS "+clientId+" - "+client.hits+" hits since "+client.start);
           
            // abusive client
            if(client.hits > this.threshold) {
                return true;
            }
           
        } else {
            log.debug("NEW "+clientId);
           
            // first timer
            ClientInfo newClient = new ClientInfo();
            newClient.hits = 1;
            newClient.id = clientId;
           
            ExpiringCacheEntry newEntry = new ExpiringCacheEntry(newClient, this.interval);
            this.clientHistoryCache.put(clientId, newEntry);
        }
       
        return false;
    }
View Full Code Here

Examples of org.apache.roller.weblogger.util.cache.ExpiringCacheEntry

            return false;
        }
       
        // see if we have any info about this client
        ClientInfo client = null;
        ExpiringCacheEntry cacheEntry = (ExpiringCacheEntry) this.clientHistoryCache.get(clientId);
        if(cacheEntry != null) {
            log.debug("HIT "+clientId);
            client = (ClientInfo) cacheEntry.getValue();
           
            // this means entry had expired
            if(client == null) {
                log.debug("EXPIRED "+clientId);
                this.clientHistoryCache.remove(clientId);
View Full Code Here

Examples of org.apache.roller.weblogger.util.cache.ExpiringCacheEntry

            if (lastModified == null) {
                lastModified = new Date();
                log.warn("Can't get lastUpdate time, using current time instead");
            }
           
            this.lastUpdateTime = new ExpiringCacheEntry(lastModified, this.timeout);
        }
       
        return lastModified;
    }
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.