You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by "Aaron Smuts (JIRA)" <ji...@apache.org> on 2008/08/01 21:28:31 UTC

[jira] Commented: (JCS-45) hierarchical deletion not working with DiskUsagePatternName=UPDATE

    [ https://issues.apache.org/jira/browse/JCS-45?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619099#action_12619099 ] 

Aaron Smuts commented on JCS-45:
--------------------------------

This isn't a problem with the disk usage pattern, it's a problem with partial key deletes and purgatory.

If you add a sleep before the remove, it works.

. . . .

        cache.put("bar:quxx", "three");
        
        SleepUtil.sleepAtLeast( 20 );
        
        cache.remove("foo:bar:");

 . . .

The partial key removal works by iterating through the keys and removing those that match.  The item is not in the key list while it is in purgatory.  Normal removal works, but not partial.  

When you put the cache in UPDATE mode, all items go directly to disk.  If you don't have it in update mode, the items just go to disk when the max memory size is reached.  


> hierarchical deletion not working with DiskUsagePatternName=UPDATE
> ------------------------------------------------------------------
>
>                 Key: JCS-45
>                 URL: https://issues.apache.org/jira/browse/JCS-45
>             Project: JCS
>          Issue Type: Bug
>          Components: Indexed Disk Cache
>    Affects Versions: jcs-1.3
>            Reporter: Philip Johnson
>            Assignee: Aaron Smuts
>
> The documentation explains that it is possible to do "hierarchical deletion" using keys with colon separators:
> <http://jakarta.apache.org/jcs/faq.html#hierarchical-removal>
> I would like this feature, but it appears to be broken when DiskUsagePatternName is specified as UPDATE. I am using Java 1.6 on Windows.
> Below is a short test program that illustrates the behavior. When I run this program without changes, it prints out "OK" two times.  When I uncomment the setProperty() line in makeProps() and re-run the program, it prints out "Error!" twice.  
> ---------------------------
> import java.util.Properties;
> import org.apache.jcs.JCS;
> import org.apache.jcs.engine.control.CompositeCacheManager;
> public class JcsProblem {
>   private static Properties makeProps() {
>     Properties props = new Properties();
>     props.setProperty("jcs.region.foo", "DC");
>     props.setProperty("jcs.region.foo.cacheattributes", "org.apache.jcs.engine.CompositeCacheAttributes");
>     props.setProperty("jcs.region.foo.MemoryCacheName", "org.apache.jcs.engine.memory.lru.LRUMemoryCache");
>     // Uncomment the following line to make hierarchical removal not work.
>     // props.setProperty("jcs.region.foo.cacheattributes.DiskUsagePatternName", "UPDATE");
>     props.setProperty("jcs.auxiliary.DC", "org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory");
>     props.setProperty("jcs.auxiliary.DC.attributes", "org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes");
>     props.setProperty("jcs.auxiliary.DC.attributes.DiskPath", System.getProperty("user.dir"));
>     return props;
>   }
>   public static void main(String[] args) throws Exception {
>     CompositeCacheManager ccm = CompositeCacheManager.getUnconfiguredInstance();
>     ccm.configure(makeProps());
>     JCS cache = JCS.getInstance("foo");
>     cache.put("foo:bar:baz", "one");
>     cache.put("foo:bar:qux", "two");
>     cache.put("bar:quxx", "three");
>     cache.remove("foo:bar:");
>     System.out.println(((cache.get("foo:bar:baz") == null) ? "OK" : "Error!"));
>     System.out.println(((cache.get("foo:bar:qux") == null) ? "OK" : "Error!"));
>   }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org