Not really get it. here is the function to get a list of keys from a group
in a region:
public void getKeyList() {
try {
//Set keyset = cache.getGroupKeys("myGroup1");
Iterator iterator = cache.getGroupKeys("myGroup1").iterator();
while (iterator.hasNext()) {
String detail = "";
String ckey = (String)iterator.next();
}
} catch(UnsupportedOperationException uoe) {
uoe.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return keyList;
}
It compiles, but at run-time, always complains "UnsupportedOperationException"
at the line:
Iterator iterator = cache.getGroupKeys("myGroup1").iterator();
detailed error msg:
java.lang.UnsupportedOperationException
at
org.apache.jcs.auxiliary.disk.file.FileDiskCache.getGroupKeys(FileDiskCache.java:143)
at
org.apache.jcs.engine.control.CompositeCache.getGroupKeys(CompositeCache.java:1110)
at
org.apache.jcs.access.GroupCacheAccess.getGroupKeys(GroupCacheAccess.java:192)
at gov.nasa.gsfc.giovanni.TestCache.getKeyList(TestCache.java:167)
at gov.nasa.gsfc.giovanni.TestCache.main(TestCache.java:608)
What could be wrong?
Thanks.
--- On Sat, 1/14/12, Thomas Vandahl <[email protected]> wrote:
From: Thomas Vandahl <[email protected]>
Subject: Re: [JCS]--How to get a list of Keys in a region
To: "Commons Users List" <[email protected]>
Date: Saturday, January 14, 2012, 4:43 AM
On 13.01.12 15:59, Chopin hu wrote:
> Vijayakumar,
>
> Thanks for your response. The method cache.putInGroup() does not seem to
> really work in my case. I am working a simple commandline utility, which
> will extract all keys from a cache region. No key/value can be known in
> advance. Besides, I don't understand the concept of "groupName" yet in a
> cache region. It looks I don't have a group name either.
>
> But is this some method that I can trick it so that it can return all cache
> keys from a region?
>
>
>
> --- On Fri, 1/13/12, NM, Vijayakumar <[email protected]> wrote:
>
> From: NM, Vijayakumar <[email protected]>
> Subject: RE: [JCS]--How to get a list of Keys in a region
> To: "Commons Users List" <[email protected]>
> Date: Friday, January 13, 2012, 12:41 AM
>
> Hi,
>
> This may be of some help.
>
> JCS cache = JCS.getInstance(regionName);
> cache.putInGroup(key, groupName, value);
>
> Set keys = cache.getGroupKeys(groupName)
This is the actual trick. Just invent some group name and put all your
keys and values into that group. Then you can get a list of keys by
calling getGroupKeys(). It would be more or less an additional wrapper
in your region.
Bye, Thomas.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]