osdir.com
mailing list archive
Mozy Online Backup: 2GB Free. Automatic. Secure.

Subject: roller/src/org/roller/presentation/caching CommonsPageCache.java,1.7,1.8 - msg#00098

List: java.roller.cvs

Date: Prev Next Index Thread: Prev Next Index
Update of /cvsroot/roller/roller/src/org/roller/presentation/caching
In directory sc8-pr-cvs1:/tmp/cvs-serv16534/src/org/roller/presentation/caching

Modified Files:
CommonsPageCache.java
Log Message:
Updating usage of Jakarta Commons Cache.

Index: CommonsPageCache.java
===================================================================
RCS file:
/cvsroot/roller/roller/src/org/roller/presentation/caching/CommonsPageCache.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** CommonsPageCache.java 14 Feb 2003 18:36:13 -0000 1.7
--- CommonsPageCache.java 16 Feb 2003 04:47:29 -0000 1.8
***************
*** 8,11 ****
--- 8,12 ----
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
+ import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
***************
*** 22,28 ****
--- 23,31 ----
import org.apache.commons.cache.MemoryStash;
import org.apache.commons.cache.SimpleCache;
+ import org.apache.commons.cache.config.CacheConfig;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.roller.model.UserData;
+ import org.roller.presentation.RollerContext;
import org.roller.presentation.RollerRequest;

***************
*** 40,44 ****
LogFactory.getFactory().getInstance(CommonsPageCache.class);

! private static String mCacheName = "PageCache";

private FilterConfig mFilterConfig = null;
--- 43,47 ----
LogFactory.getFactory().getInstance(CommonsPageCache.class);

! private static final String CACHENAME = "PageCache";

private FilterConfig mFilterConfig = null;
***************
*** 152,177 ****

/**
! * Get the cache for the ServerHost.code passed in.
! * If none, create one.
**/
public synchronized Cache getCache()
{
! if(CacheSingleton.hasCache(mCacheName))
{
! return CacheSingleton.getCache(mCacheName);
}

! SimpleCache cache = new SimpleCache(
new MemoryStash( mMaxObjects ),
new LRUEvictionPolicy(),
null,
new GroupMapImpl() );
if(null != cache)
{
! CacheSingleton.putCache(mCacheName, cache);
! return cache;
}

! return null;
}

--- 155,205 ----

/**
! * Get the cache for Pages. If none, create one.
! * Uses Commons Cache CacheConfig object to read a configuration file,
! * failing that creates one using the values from the Filter's
initialization.
! *
**/
public synchronized Cache getCache()
{
! if(CacheSingleton.hasCache(CACHENAME))
{
! return CacheSingleton.getCache(CACHENAME);
}
+
+ Cache cache = null;
+ java.io.InputStream in = null;
+ String fileName = "CommonsCache" + CACHENAME + ".config";
+ try
+ {
+ ServletContext app = RollerContext.getServletContext();
+ in = app.getResourceAsStream("/WEB-INF/" + fileName);

! CacheConfig cConfig = CacheConfig.getInstance( CACHENAME, in );
! cache = cConfig.getCache();
! }
! catch( Exception e)
! {
! mLogger.warn("Unable to load config file: " + fileName);
! cache = new SimpleCache(
new MemoryStash( mMaxObjects ),
new LRUEvictionPolicy(),
null,
new GroupMapImpl() );
+ }
+ finally
+ {
+ try {
+ if (in != null) in.close();
+ } catch (java.io.IOException ioe) {
+ mLogger.warn("CommonsPageCache.getCache() unable to close
InputStream");
+ }
+ }
+
if(null != cache)
{
! CacheSingleton.putCache(CACHENAME, cache);
}

! return cache;
}





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

roller/src/org/roller/presentation/caching CommonsPageCache.java,1.6,1.7

Update of /cvsroot/roller/roller/src/org/roller/presentation/caching In directory sc8-pr-cvs1:/tmp/cvs-serv24214/src/org/roller/presentation/caching Modified Files: CommonsPageCache.java Log Message: Velocity integration should be finished now. I've come to find a great many frustrations with Velocity in relation to NULL objects and arrays! Index: CommonsPageCache.java =================================================================== RCS file: /cvsroot/roller/roller/src/org/roller/presentation/caching/CommonsPageCache.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CommonsPageCache.java 20 Jan 2003 04:33:04 -0000 1.6 --- CommonsPageCache.java 14 Feb 2003 18:36:13 -0000 1.7 *************** *** 18,21 **** --- 18,22 ---- import org.apache.commons.cache.Cache; import org.apache.commons.cache.CacheSingleton; + import org.apache.commons.cache.GroupMapImpl; import org.apache.commons.cache.LRUEvictionPolicy; import org.apache.commons.cache.MemoryStash; *************** *** 162,166 **** SimpleCache cache = new SimpleCache( ! new MemoryStash( mMaxObjects ), new LRUEvictionPolicy() ); if(null != cache) { --- 163,170 ---- SimpleCache cache = new SimpleCache( ! new MemoryStash( mMaxObjects ), ! new LRUEvictionPolicy(), ! null, ! new GroupMapImpl() ); if(null != cache) { ------------------------------------------------------- This SF.NET email is sponsored by: FREE SSL Guide from Thawte are you planning your Web Server Security? Click here to get a FREE Thawte SSL guide and find the answers to all your SSL security issues. http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en

Next Message by Date: click to view message preview

roller/deploy/WEB-INF CommonsCachePageCache.config,NONE,1.1

Update of /cvsroot/roller/roller/deploy/WEB-INF In directory sc8-pr-cvs1:/tmp/cvs-serv16534/deploy/WEB-INF Added Files: CommonsCachePageCache.config Log Message: Updating usage of Jakarta Commons Cache. --- NEW FILE: CommonsCachePageCache.config --- <cache-config> <cache clazz="org.apache.commons.cache.SimpleCache"> <stash clazz="org.apache.commons.cache.MemoryStash" maxObjs="1000" /> <evictionpolicy clazz="org.apache.commons.cache.LRUEvictionPolicy" objsBetweenNaps="5" sleepTimeMillis="600000" /> <stashpolicy clazz="org.apache.commons.cache.StashPolicy" isNull="true" /> <groupmap clazz="org.apache.commons.cache.GroupMapImpl" isNull="false" /> <file /> </cache> </cache-config> <!-- The above is equivalent to new org.apache.commons.cache.SimpleCache( new org.apache.commons.cache.MemoryStash(1000), new org.apache.commons.cache.LRUEvictionPolicy(5, 600000L), (org.apache.commons.cache.StashPolicy)null, new org.apache.commons.cache.GroupMapImpl(), (java.io.File)null ) Read the Jakarta Commons Cache API to learn more about configuring Cache's using the CacheConfig object. --> ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf

Previous Message by Thread: click to view message preview

roller/src/org/roller/presentation/caching CommonsPageCache.java,1.6,1.7

Update of /cvsroot/roller/roller/src/org/roller/presentation/caching In directory sc8-pr-cvs1:/tmp/cvs-serv24214/src/org/roller/presentation/caching Modified Files: CommonsPageCache.java Log Message: Velocity integration should be finished now. I've come to find a great many frustrations with Velocity in relation to NULL objects and arrays! Index: CommonsPageCache.java =================================================================== RCS file: /cvsroot/roller/roller/src/org/roller/presentation/caching/CommonsPageCache.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CommonsPageCache.java 20 Jan 2003 04:33:04 -0000 1.6 --- CommonsPageCache.java 14 Feb 2003 18:36:13 -0000 1.7 *************** *** 18,21 **** --- 18,22 ---- import org.apache.commons.cache.Cache; import org.apache.commons.cache.CacheSingleton; + import org.apache.commons.cache.GroupMapImpl; import org.apache.commons.cache.LRUEvictionPolicy; import org.apache.commons.cache.MemoryStash; *************** *** 162,166 **** SimpleCache cache = new SimpleCache( ! new MemoryStash( mMaxObjects ), new LRUEvictionPolicy() ); if(null != cache) { --- 163,170 ---- SimpleCache cache = new SimpleCache( ! new MemoryStash( mMaxObjects ), ! new LRUEvictionPolicy(), ! null, ! new GroupMapImpl() ); if(null != cache) { ------------------------------------------------------- This SF.NET email is sponsored by: FREE SSL Guide from Thawte are you planning your Web Server Security? Click here to get a FREE Thawte SSL guide and find the answers to all your SSL security issues. http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en

Next Message by Thread: click to view message preview

roller/deploy/WEB-INF CommonsCachePageCache.config,NONE,1.1

Update of /cvsroot/roller/roller/deploy/WEB-INF In directory sc8-pr-cvs1:/tmp/cvs-serv16534/deploy/WEB-INF Added Files: CommonsCachePageCache.config Log Message: Updating usage of Jakarta Commons Cache. --- NEW FILE: CommonsCachePageCache.config --- <cache-config> <cache clazz="org.apache.commons.cache.SimpleCache"> <stash clazz="org.apache.commons.cache.MemoryStash" maxObjs="1000" /> <evictionpolicy clazz="org.apache.commons.cache.LRUEvictionPolicy" objsBetweenNaps="5" sleepTimeMillis="600000" /> <stashpolicy clazz="org.apache.commons.cache.StashPolicy" isNull="true" /> <groupmap clazz="org.apache.commons.cache.GroupMapImpl" isNull="false" /> <file /> </cache> </cache-config> <!-- The above is equivalent to new org.apache.commons.cache.SimpleCache( new org.apache.commons.cache.MemoryStash(1000), new org.apache.commons.cache.LRUEvictionPolicy(5, 600000L), (org.apache.commons.cache.StashPolicy)null, new org.apache.commons.cache.GroupMapImpl(), (java.io.File)null ) Read the Jakarta Commons Cache API to learn more about configuring Cache's using the CacheConfig object. --> ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
Sign up for updates to this mailing list. email:
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by