jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Smuts <asm...@yahoo.com>
Subject Re: Can I remove multiple entries from Cache in a single go?
Date Sat, 26 Aug 2006 15:36:16 GMT
Yes, but it is somewhat expensive, since some of the
auxiliaries will have to iterate over their keysets. 
Although all the auxiliaries honor this, it is not
part of the auxiliary API.  There is no method along
the lins of "removeStartingWith", but all the remove
methods can do it. 

By default, the hierarchical key delimiter used in JCS
is a colon.  You cannot add a String key that ends
with a colon.  If you call remove with a String key
that ends in a colon, everything that has a key that
starts with the argument will be removed.

If your keys are in this format


And you put n objects int he cache with keys like this

"ABC:123:0"  to "ABC:123:n"

then you could remove all the obejcts by calling 

jcs.remove( "ABC:123:" );



--- Rupesh Khandelwal <rupesh.khandelwal@gmail.com>

> Hi,
> I am using JCS cache for storing objects that I need
> to display very
> frequently.
> For every entry the key looks like
> *LIST_2_AGENT_123981*,
> the pattern is like *Type_Source Id_Object
> Type_Object ID*.
> Total entries following the same pattern evaluates
> to *4*10*40*1000*
> Whenever I refresh the data source, I need to remove
> all the data
> corresponding to it.
> To remove all the entries starting with *LIST_2* can
> I call remove method
> with some key like *LIST_2_** i.e. in general,
> *Type|Source Id|**
> Please suggest how can I achieve above requirement
> in JCS.
> Regards,
> Rupesh K

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

View raw message