Package org.apache.roller.util.cache

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


                if (updateTime == null) {
                    updateTime = new Date();
                    mLogger.warn("Can't get lastUpdate time, using current time instead");
                }
               
                this.lastUpdateTime = new ExpiringCacheEntry(updateTime, this.timeout);
            }
           
            // RSS context loader needs updateTime, so stash it
            request.setAttribute("updateTime", updateTime);
           
View Full Code Here


        }
       
        // 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

            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

        }
       
        // 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

            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

            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

            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

TOP

Related Classes of org.apache.roller.util.cache.ExpiringCacheEntry

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.