[jbosscache-dev] Some new Cache usage questions

Manik Surtani manik at jboss.org
Mon Sep 4 07:06:15 EDT 2006


Not in your case, no.  But many other use cases will be able to cache  
a node and use it directly.

I too would rather keep the API clean in this regard.  Also, calling  
cache.getRoot() is redundant since the Cache interface is a wrapper  
around the root Node.  In fact, I even think we should get rid of the  
getRoot() method.

Cheers,
--
Manik Surtani

Lead, JBoss Cache
JBoss, a division of Red Hat

Email: manik at jboss.org
Telephone: +44 7786 702 706
MSN: manik at surtani.org
Yahoo/AIM/Skype: maniksurtani


On 1 Sep 2006, at 15:49, Ben Wang wrote:

> Thing is I only do put to specific fqn once. So caching it doesn't  
> buy you anything.
>
> -----Original Message-----
> From: Bela Ban
> Sent: Friday, September 01, 2006 10:22 PM
> To: Ben Wang
> Cc: jbosscache-dev at lists.jboss.org
> Subject: Re: [jbosscache-dev] Some new Cache usage questions
>
> My 2 cents: I'd rather keep the API clean, at the expense of folks  
> potentially writing wrapping code (like Ben).
>
> Your code samples look a bit weird:
> #1
> Why do you always get the child ? Can't you get the node and cache  
> it, e.g.
> Node n=cache.getRoot().getChild(fqn);
> n.containsKey(PojoInstance.KEY)
>
> #2
> Same as for #1: you don't need to call cache.getRoot().getChild 
> (fqn) all the time, for example in a loop, simply cache it
>
>
> Ben Wang wrote:
>> Manik,
>>
>> While trying to use the new API in PojoCache, I have found that I  
>> need to:
>>
>> 1. To check if a attribute exist, I need to do:
>> cache_.getRoot().getChild(fqn_).getData().values().contains 
>> (PojoInstance.KEY)
>>
>> 2. And then, I need to do a lot of cache_.getRoot().getChild 
>> (fqn).put(map)
>>
>> So looks like I need to write a wrapper layer just to provide  
>> straight
>> api for:
>>
>> Cache_.exists(fqn, key)
>> And
>> Cache_.put(fqn, map)
>>
>> If this is rare case, then I will bite the bullet. But if it is a
>> common one, then that really begs the question whether we should
>> provide additional apis or not?
>
> -- 
> Bela Ban
> Lead JGroups / Manager JBoss Clustering Group
> JBoss - a division of Red Hat
>
> _______________________________________________
> jbosscache-dev mailing list
> jbosscache-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosscache-dev




More information about the jbosscache-dev mailing list