[EMAIL PROTECTED] wrote:
Author: arje
Date: Fri Nov 11 09:17:23 2005
New Revision: 332608
URL: http://svn.apache.org/viewcvs?rev=332608view=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=332608r1=332607r2=332608view=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 @@
* licodemaxobjects/code (1) - The maximum number of in-memory
objects./li
* licodeoverflow-to-disk/code (true) - Whether to spool elements to
disk after
* maxobjects has been exceeded./li
+ * licodeeternal/code (true) - whether or not entries expire. When
set to
+ * codefalse/code the codetimeToLiveSeconds/code and
+ * codetimeToIdleSeconds/code parameters are used to determine when an
+ * item expires./li
+ * licodetimeToLiveSeconds/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
+ * licodetimeToIdleSeconds/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
* licodeuse-cache-directory/code (false) - If true the
icache-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
* licodedirectory/code - Specify an alternative location of the
disk store.
* /ul
+ *
+ * p
+ * Setting codeeternal/code to codefalse/code but not setting
+ * codetimeToLiveSeconds/code and/or codetimeToIdleSeconds/code,
has the
+ * same effect as setting codeeternal/code to codetrue/code.
+ * /p
+ *
+ * p
+ * Here is an example to clarify the purpose of the
codetimeToLiveSeconds/code and
+ * codetimeToIdleSeconds/code parameters:
+ * /p
+ * ul
+ * litimeToLiveSeconds = 86400 (1 day)/li
+ * litimeToIdleSeconds = 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 codetimeToLiveSeconds/code to code0/code, an item
can stay in
+ * the cache as long as it is retrieved within
codetimeToIdleSeconds/code after the
+ * last retrieval.
+ * /p
+ *
+ * p
+ * By setting codetimeToIdleSeconds/code to code0/code, an item
will stay in
+ * the cache for exactly codetimeToLiveSeconds/code.
+ * /p
*/
public void parameterize(Parameters parameters) throws ParameterException {
this.maxObjects = parameters.getParameterAsInteger(maxobjects, 1);
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);