cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Gallardo <agalla...@agssa.net>
Subject Re: svn commit: r332608 - /cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
Date Fri, 11 Nov 2005 17:29:50 GMT
arje@apache.org wrote:

>Author: arje
>Date: Fri Nov 11 09:17:23 2005
>New Revision: 332608
>
>URL: http://svn.apache.org/viewcvs?rev=332608&view=rev
>Log:
>Applied patch for issue 1683: Allow configuration of expiry in EHDefaultStore
>http://issues.apache.org/jira/browse/COCOON-1683
>+ Changed the copyright notice to "2004, 2005"
>Please let me know if I did it wrong 8-%
>  
>
Do you doing very well! :-)

2 small points:

A. Use 2004-2005 instead
B. Patch also 2.1.8. ;-)

Best Regards,

Antonio Gallardo.

>Modified:
>    cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
>
>Modified: cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
>URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java?rev=332608&r1=332607&r2=332608&view=diff
>==============================================================================
>--- cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
(original)
>+++ cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
Fri Nov 11 09:17:23 2005
>@@ -1,5 +1,5 @@
> /*
>- * Copyright 2004,2004 The Apache Software Foundation.
>+ * Copyright 2004, 2005 The Apache Software Foundation.
>  * 
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>@@ -70,6 +70,9 @@
>     // configuration options
>     private int maxObjects;
>     private boolean overflowToDisk;
>+    private boolean eternal;
>+    private long timeToLiveSeconds;
>+    private long timeToIdleSeconds;
> 
>     /** The service manager */
>     private ServiceManager manager;
>@@ -109,6 +112,15 @@
>      *  <li><code>maxobjects</code> (10000) - The maximum number of
in-memory objects.</li>
>      *  <li><code>overflow-to-disk</code> (true) - Whether to spool
elements to disk after
>      *   maxobjects has been exceeded.</li>
>+     * <li><code>eternal</code> (true) - whether or not entries expire.
When set to
>+     * <code>false</code> the <code>timeToLiveSeconds</code>
and
>+     * <code>timeToIdleSeconds</code> parameters are used to determine when
an
>+     * item expires.</li>
>+     * <li><code>timeToLiveSeconds</code> (0) - how long an entry may
live in the cache
>+     * before it is removed. The entry will be removed no matter how frequently it is
retrieved.</li>
>+     * <li><code>timeToIdleSeconds</code> (0) - the maximum time between
retrievals
>+     * of an entry. If the entry is not retrieved for this period, it is removed from
the
>+     * cache.</li>
>      *  <li><code>use-cache-directory</code> (false) - If true the
<i>cache-directory</i>
>      *   context entry will be used as the location of the disk store. 
>      *   Within the servlet environment this is set in web.xml.</li>
>@@ -117,11 +129,50 @@
>      *   Within the servlet environment this is set in web.xml.</li>
>      *  <li><code>directory</code> - Specify an alternative location
of the disk store.
>      * </ul>
>+     * 
>+     * <p>
>+     * Setting <code>eternal</code> to <code>false</code> but
not setting
>+     * <code>timeToLiveSeconds</code> and/or <code>timeToIdleSeconds</code>,
has the
>+     * same effect as setting <code>eternal</code> to <code>true</code>.
>+     * </p>
>+     * 
>+     * <p>
>+     * Here is an example to clarify the purpose of the <code>timeToLiveSeconds</code>
and
>+     * <code>timeToIdleSeconds</code> parameters:
>+     * </p>
>+     * <ul>
>+     *   <li>timeToLiveSeconds = 86400 (1 day)</li>
>+     *   <li>timeToIdleSeconds = 10800 (3 hours)</li>
>+     * </ul>
>+     * 
>+     * <p>
>+     * With these settings the entry will be removed from the cache after 24 hours. If
within
>+     * that 24-hour period the entry is not retrieved within 3 hours after the last retrieval,
it will
>+     * also be removed from the cache.
>+     * </p>
>+     * 
>+     * <p>
>+     * By setting <code>timeToLiveSeconds</code> to <code>0</code>,
an item can stay in
>+     * the cache as long as it is retrieved within <code>timeToIdleSeconds</code>
after the
>+     * last retrieval.
>+     * </p>
>+     * 
>+     * <p>
>+     * By setting <code>timeToIdleSeconds</code> to <code>0</code>,
an item will stay in
>+     * the cache for exactly <code>timeToLiveSeconds</code>.
>+     * </p>
>      */
>     public void parameterize(Parameters parameters) throws ParameterException {
> 
>         this.maxObjects = parameters.getParameterAsInteger("maxobjects", 10000);
>         this.overflowToDisk = parameters.getParameterAsBoolean("overflow-to-disk", true);
>+        
>+        this.eternal = parameters.getParameterAsBoolean("eternal", true);
>+        if (!this.eternal)
>+        {
>+            this.timeToLiveSeconds = parameters.getParameterAsLong("timeToLiveSeconds",
0L);
>+            this.timeToIdleSeconds = parameters.getParameterAsLong("timeToIdleSeconds",
0L);
>+        }
> 
>         try {
>             if (parameters.getParameterAsBoolean("use-cache-directory", false)) {
>@@ -211,7 +262,8 @@
>     public void initialize() throws Exception {
>         URL configFileURL = Thread.currentThread().getContextClassLoader().getResource(CONFIG_FILE);
>         this.cacheManager = CacheManager.create(configFileURL);
>-        this.cache = new Cache(this.cacheName, this.maxObjects, this.overflowToDisk,
true, 0, 0, true, 120);
>+        this.cache = new Cache(this.cacheName, this.maxObjects, this.overflowToDisk,
this.eternal,
>+                this.timeToLiveSeconds, this.timeToIdleSeconds, true, 120);
>         this.cacheManager.addCache(this.cache);
>         this.storeJanitor.register(this);
>     }
>
>  
>


Mime
View raw message