Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 79760 invoked from network); 11 Nov 2005 17:30:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Nov 2005 17:30:33 -0000 Received: (qmail 45249 invoked by uid 500); 11 Nov 2005 17:30:21 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 45161 invoked by uid 500); 11 Nov 2005 17:30:21 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 45089 invoked by uid 99); 11 Nov 2005 17:30:20 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Nov 2005 09:30:20 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [165.98.153.184] (HELO ags01.agssa.net) (165.98.153.184) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Nov 2005 09:30:13 -0800 Received: from [10.0.0.7] (apoyo.agssa.net [10.0.0.7]) by ags01.agssa.net (8.13.1/8.13.1) with ESMTP id jABHTpCt027832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 11 Nov 2005 11:29:52 -0600 Message-ID: <4374D50E.7000006@agssa.net> Date: Fri, 11 Nov 2005 11:29:50 -0600 From: Antonio Gallardo Organization: AG Software, S. A. User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: svn commit: r332608 - /cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java References: <20051111171809.71935.qmail@minotaur.apache.org> In-Reply-To: <20051111171809.71935.qmail@minotaur.apache.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.7.5 (ags01.agssa.net [165.98.153.184]); Fri, 11 Nov 2005 11:29:52 -0600 (CST) Received-SPF: pass (ags01.agssa.net: 10.0.0.7 is whitelisted) receiver=ags01.agssa.net; client-ip=10.0.0.7; helo=[10.0.0.7]; envelope-from=agallardo@agssa.net; x-software=spfmilter 0.93 http://www.acme.com/software/spfmilter/; X-Virus-Scanned: ClamAV version 0.87.1, clamav-milter version 0.87 on agssa.net X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on ags01.agssa.net X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-2.7 required=5.0 tests=ALL_TRUSTED,AWL autolearn=ham version=3.0.4 X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 @@ > *
  • maxobjects (10000) - The maximum number of in-memory objects.
  • > *
  • overflow-to-disk (true) - Whether to spool elements to disk after > * maxobjects has been exceeded.
  • >+ *
  • eternal (true) - whether or not entries expire. When set to >+ * false the timeToLiveSeconds and >+ * timeToIdleSeconds parameters are used to determine when an >+ * item expires.
  • >+ *
  • timeToLiveSeconds (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.
  • >+ *
  • timeToIdleSeconds (0) - the maximum time between retrievals >+ * of an entry. If the entry is not retrieved for this period, it is removed from the >+ * cache.
  • > *
  • use-cache-directory (false) - If true the cache-directory > * context entry will be used as the location of the disk store. > * Within the servlet environment this is set in web.xml.
  • >@@ -117,11 +129,50 @@ > * Within the servlet environment this is set in web.xml. > *
  • directory - Specify an alternative location of the disk store. > * >+ * >+ *

    >+ * Setting eternal to false but not setting >+ * timeToLiveSeconds and/or timeToIdleSeconds, has the >+ * same effect as setting eternal to true. >+ *

    >+ * >+ *

    >+ * Here is an example to clarify the purpose of the timeToLiveSeconds and >+ * timeToIdleSeconds parameters: >+ *

    >+ *
      >+ *
    • timeToLiveSeconds = 86400 (1 day)
    • >+ *
    • timeToIdleSeconds = 10800 (3 hours)
    • >+ *
    >+ * >+ *

    >+ * 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. >+ *

    >+ * >+ *

    >+ * By setting timeToLiveSeconds to 0, an item can stay in >+ * the cache as long as it is retrieved within timeToIdleSeconds after the >+ * last retrieval. >+ *

    >+ * >+ *

    >+ * By setting timeToIdleSeconds to 0, an item will stay in >+ * the cache for exactly timeToLiveSeconds. >+ *

    > */ > 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); > } > > >