roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r430836 - in /incubator/roller/branches/roller_3.0: src/org/apache/roller/ui/rendering/util/ web/WEB-INF/classes/
Date Fri, 11 Aug 2006 17:47:56 GMT
Author: agilliland
Date: Fri Aug 11 10:47:55 2006
New Revision: 430836

URL: http://svn.apache.org/viewvc?rev=430836&view=rev
Log:
enable rendering caches to be enabled/disabled via config.


Modified:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/PlanetCache.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/SiteWideCache.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogFeedCache.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageCache.java
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/roller.properties

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/PlanetCache.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/PlanetCache.java?rev=430836&r1=430835&r2=430836&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/PlanetCache.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/PlanetCache.java
Fri Aug 11 10:47:55 2006
@@ -44,6 +44,7 @@
     public static final String CACHE_ID = "cache.planet";
     
     // keep cached content
+    private boolean cacheEnabled = true;
     private Cache contentCache = null;
     
     // keep a cached version of last expired time
@@ -56,6 +57,8 @@
     
     private PlanetCache() {
         
+        cacheEnabled = RollerConfig.getBooleanProperty(CACHE_ID+".enabled");
+        
         Map cacheProps = new HashMap();
         cacheProps.put("id", CACHE_ID);
         Enumeration allProps = RollerConfig.keys();
@@ -72,7 +75,11 @@
         
         log.info("Planet cache = "+cacheProps);
         
-        contentCache = CacheManager.constructCache(null, cacheProps);
+        if(cacheEnabled) {
+            contentCache = CacheManager.constructCache(null, cacheProps);
+        } else {
+            log.warn("Caching has been DISABLED");
+        }
         
         // lookup our timeout value
         String timeoutString = RollerConfig.getProperty("cache.planet.timeout");
@@ -92,6 +99,9 @@
     
     public Object get(String key) {
         
+        if(!cacheEnabled)
+            return null;
+        
         Object entry = contentCache.get(key);
         
         if(entry == null) {
@@ -105,18 +115,30 @@
     
     
     public void put(String key, Object value) {
+        
+        if(!cacheEnabled)
+            return;
+        
         contentCache.put(key, value);
         log.debug("PUT "+key);
     }
     
     
     public void remove(String key) {
+        
+        if(!cacheEnabled)
+            return;
+        
         contentCache.remove(key);
         log.debug("REMOVE "+key);
     }
     
     
     public void clear() {
+        
+        if(!cacheEnabled)
+            return;
+        
         contentCache.clear();
         this.lastUpdateTime = null;
         log.debug("CLEAR");

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/SiteWideCache.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/SiteWideCache.java?rev=430836&r1=430835&r2=430836&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/SiteWideCache.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/SiteWideCache.java
Fri Aug 11 10:47:55 2006
@@ -57,6 +57,7 @@
     public static final String CACHE_ID = "cache.sitewide";
     
     // keep cached content
+    private boolean cacheEnabled = true;
     private Cache contentCache = null;
     
     // keep a cached version of last expired time
@@ -69,6 +70,8 @@
     
     private SiteWideCache() {
         
+        cacheEnabled = RollerConfig.getBooleanProperty(CACHE_ID+".enabled");
+        
         Map cacheProps = new HashMap();
         cacheProps.put("id", CACHE_ID);
         Enumeration allProps = RollerConfig.keys();
@@ -85,7 +88,11 @@
         
         log.info(cacheProps);
         
-        contentCache = CacheManager.constructCache(this, cacheProps);
+        if(cacheEnabled) {
+            contentCache = CacheManager.constructCache(this, cacheProps);
+        } else {
+            log.warn("Caching has been DISABLED");
+        }
     }
     
     
@@ -96,6 +103,9 @@
     
     public Object get(String key) {
         
+        if(!cacheEnabled)
+            return null;
+        
         Object entry = contentCache.get(key);
         
         if(entry == null) {
@@ -109,18 +119,30 @@
     
     
     public void put(String key, Object value) {
+        
+        if(!cacheEnabled)
+            return;
+        
         contentCache.put(key, value);
         log.debug("PUT "+key);
     }
 
     
     public void remove(String key) {
+        
+        if(!cacheEnabled)
+            return;
+        
         contentCache.remove(key);
         log.debug("REMOVE "+key);
     }
     
     
     public void clear() {
+        
+        if(!cacheEnabled)
+            return;
+        
         contentCache.clear();
         this.lastUpdateTime = null;
         log.debug("CLEAR");
@@ -280,6 +302,10 @@
      * A weblog entry has changed.
      */
     public void invalidate(WeblogEntryData entry) {
+        
+        if(!cacheEnabled)
+            return;
+        
         this.contentCache.clear();
         this.lastUpdateTime = null;
     }
@@ -289,6 +315,10 @@
      * A weblog has changed.
      */
     public void invalidate(WebsiteData website) {
+        
+        if(!cacheEnabled)
+            return;
+        
         this.contentCache.clear();
         this.lastUpdateTime = null;
     }

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogFeedCache.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogFeedCache.java?rev=430836&r1=430835&r2=430836&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogFeedCache.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogFeedCache.java
Fri Aug 11 10:47:55 2006
@@ -44,6 +44,7 @@
     public static final String CACHE_ID = "cache.weblogfeed";
     
     // keep cached content
+    private boolean cacheEnabled = true;
     private Cache contentCache = null;
     
     // reference to our singleton instance
@@ -52,6 +53,8 @@
     
     private WeblogFeedCache() {
         
+        cacheEnabled = RollerConfig.getBooleanProperty(CACHE_ID+".enabled");
+        
         Map cacheProps = new HashMap();
         cacheProps.put("id", CACHE_ID);
         Enumeration allProps = RollerConfig.keys();
@@ -68,7 +71,11 @@
         
         log.info(cacheProps);
         
-        contentCache = CacheManager.constructCache(null, cacheProps);
+        if(cacheEnabled) {
+            contentCache = CacheManager.constructCache(null, cacheProps);
+        } else {
+            log.warn("Caching has been DISABLED");
+        }
     }
     
     
@@ -79,6 +86,9 @@
     
     public Object get(String key, long lastModified) {
         
+        if(!cacheEnabled)
+            return null;
+        
         Object entry = null;
         
         LazyExpiringCacheEntry lazyEntry =
@@ -101,18 +111,30 @@
     
     
     public void put(String key, Object value) {
+        
+        if(!cacheEnabled)
+            return;
+        
         contentCache.put(key, new LazyExpiringCacheEntry(value));
         log.debug("PUT "+key);
     }
     
     
     public void remove(String key) {
+        
+        if(!cacheEnabled)
+            return;
+        
         contentCache.remove(key);
         log.debug("REMOVE "+key);
     }
     
     
     public void clear() {
+        
+        if(!cacheEnabled)
+            return;
+        
         contentCache.clear();
         log.debug("CLEAR");
     }

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageCache.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageCache.java?rev=430836&r1=430835&r2=430836&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageCache.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageCache.java
Fri Aug 11 10:47:55 2006
@@ -45,6 +45,7 @@
     public static final String CACHE_ID = "cache.weblogpage";
     
     // keep cached content
+    private boolean cacheEnabled = true;
     private Cache contentCache = null;
     
     // reference to our singleton instance
@@ -53,6 +54,8 @@
     
     private WeblogPageCache() {
         
+        cacheEnabled = RollerConfig.getBooleanProperty(CACHE_ID+".enabled");
+        
         Map cacheProps = new HashMap();
         cacheProps.put("id", CACHE_ID);
         Enumeration allProps = RollerConfig.keys();
@@ -69,7 +72,11 @@
         
         log.info(cacheProps);
         
-        contentCache = CacheManager.constructCache(null, cacheProps);
+        if(cacheEnabled) {
+            contentCache = CacheManager.constructCache(null, cacheProps);
+        } else {
+            log.warn("Caching has been DISABLED");
+        }
     }
     
     
@@ -80,6 +87,9 @@
     
     public Object get(String key, long lastModified) {
         
+        if(!cacheEnabled)
+            return null;
+        
         Object entry = null;
         
         LazyExpiringCacheEntry lazyEntry =
@@ -102,18 +112,30 @@
     
     
     public void put(String key, Object value) {
+        
+        if(!cacheEnabled)
+            return;
+        
         contentCache.put(key, new LazyExpiringCacheEntry(value));
         log.debug("PUT "+key);
     }
     
     
     public void remove(String key) {
+        
+        if(!cacheEnabled)
+            return;
+        
         contentCache.remove(key);
         log.debug("REMOVE "+key);
     }
     
     
     public void clear() {
+        
+        if(!cacheEnabled)
+            return;
+        
         contentCache.clear();
         log.debug("CLEAR");
     }

Modified: incubator/roller/branches/roller_3.0/web/WEB-INF/classes/roller.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/classes/roller.properties?rev=430836&r1=430835&r2=430836&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/classes/roller.properties (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/classes/roller.properties Fri Aug 11
10:47:55 2006
@@ -176,18 +176,22 @@
 cache.futureInvalidations.peerTime=3
 
 # Site-wide cache (all content for site-wide frontpage weblog)
+cache.sitewide.enabled=true
 cache.sitewide.size=50
 cache.sitewide.timeout=1800
 
 # Weblog page cache (all the weblog content)
+cache.weblogpage.enabled=true
 cache.weblogpage.size=400
 cache.weblogpage.timeout=3600
 
 # Feed cache (xml feeds like rss, atom, etc)
+cache.weblogfeed.enabled=true
 cache.weblogfeed.size=200
 cache.weblogfeed.timeout=3600
 
 # Planet cache (planet page and rss feed)
+cache.planet.enabled=true
 cache.planet.size=10
 cache.planet.timeout=1800
 



Mime
View raw message