cziegeler    2003/07/31 07:28:19

  Modified:    src/java/org/apache/cocoon/caching/impl CacheImpl.java
               src/java/org/apache/cocoon/caching Cache.java
  Log:
  Changing type of key to allow more generic caching algorithms
  
  Revision  Changes    Path
  1.5       +11 -9     
cocoon-2.1/src/java/org/apache/cocoon/caching/impl/CacheImpl.java
  
  Index: CacheImpl.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/caching/impl/CacheImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CacheImpl.java    13 Jul 2003 03:10:10 -0000      1.4
  +++ CacheImpl.java    31 Jul 2003 14:28:18 -0000      1.5
  @@ -50,10 +50,14 @@
   */
   package org.apache.cocoon.caching.impl;
   
  +import java.io.IOException;
  +import java.io.Serializable;
  +import java.util.Map;
  +
   import org.apache.avalon.framework.activity.Disposable;
  -import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
  +import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.parameters.ParameterException;
   import org.apache.avalon.framework.parameters.Parameterizable;
  @@ -62,10 +66,7 @@
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.caching.Cache;
   import org.apache.cocoon.caching.CachedResponse;
  -import org.apache.cocoon.caching.PipelineCacheKey;
   import org.apache.excalibur.store.Store;
  -import java.io.IOException;
  -import java.util.Map;
   
   /**
    * This is the Cocoon cache. This component is responsible for storing
  @@ -112,7 +113,7 @@
        * @param response    the cached response
        */
       public void store(Map              objectModel,
  -                      PipelineCacheKey key,
  +                      Serializable     key,
                         CachedResponse   response)
       throws ProcessingException {
           try {
  @@ -128,7 +129,7 @@
        * @param key         the key used by the caching algorithm to identify the
        *                    request
        */
  -    public CachedResponse get(PipelineCacheKey key) {
  +    public CachedResponse get(Serializable key) {
           return (CachedResponse)this.store.get(key);
       }
   
  @@ -138,7 +139,7 @@
        * @param key         the key used by the caching algorithm to identify the
        *                    request
        */
  -    public void remove(PipelineCacheKey key) {
  +    public void remove(Serializable key) {
           this.store.remove(key);
       }
   
  @@ -146,13 +147,14 @@
        * clear cache of all cached responses 
        */
       public void clear() {
  +        // FIXME this clears the whole store!
           this.store.clear();
       }
   
        /**
         * See if a response is cached under this key
         */
  -     public boolean containsKey(PipelineCacheKey key) {
  +     public boolean containsKey(Serializable key) {
                return this.store.containsKey(key);
        }
   
  
  
  
  1.3       +7 -5      cocoon-2.1/src/java/org/apache/cocoon/caching/Cache.java
  
  Index: Cache.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/caching/Cache.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Cache.java        13 Jul 2003 03:10:10 -0000      1.2
  +++ Cache.java        31 Jul 2003 14:28:18 -0000      1.3
  @@ -52,6 +52,8 @@
   
   import org.apache.avalon.framework.component.Component;
   import org.apache.cocoon.ProcessingException;
  +
  +import java.io.Serializable;
   import java.util.Map;
   
   /**
  @@ -78,7 +80,7 @@
        * @param response    the cached response
        */
       void store(Map              objectModel,
  -               PipelineCacheKey key,
  +               Serializable     key,
                  CachedResponse   response)
       throws ProcessingException;
   
  @@ -88,7 +90,7 @@
        * @param key         the key used by the caching algorithm to identify the
        *                    request
        */
  -    CachedResponse get(PipelineCacheKey key);
  +    CachedResponse get(Serializable key);
   
       /**
        * Remove a cached response.
  @@ -96,7 +98,7 @@
        * @param key         the key used by the caching algorithm to identify the
        *                    request
        */
  -    void remove(PipelineCacheKey key);
  +    void remove(Serializable key);
       
       /**
        * clear cache of all cached responses 
  @@ -106,5 +108,5 @@
       /**
        * See if a response is cached under this key.
        */
  -    boolean containsKey(PipelineCacheKey key);
  +    boolean containsKey(Serializable key);
   }
  
  
  

Reply via email to