commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chopin hu <>
Subject RE: [JCS]--How to get a list of Keys in a region
Date Fri, 13 Jan 2012 14:59:46 GMT

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 <> wrote:

From: NM, Vijayakumar <>
Subject: RE: [JCS]--How to get a list of Keys in a region
To: "Commons Users List" <>
Date: Friday, January 13, 2012, 12:41 AM


This may be of some help.

JCS cache = JCS.getInstance(regionName);
cache.putInGroup(key, groupName, value);

Set keys = cache.getGroupKeys(groupName)


-----Original Message-----
From: Chopin hu [] 
Sent: 13 January 2012 09:52
Subject: [JCS]--How to get a list of Keys in a region

I need to get all of keys in a specific region, and then using the key to find a cache item
details -- like the lastAccessTime, the cache creationTime, and others etc.    
I used the following code:

JCSAdminBean admin = new JCSAdminBean();
List elements = admin.buildElementInfo(myRegion1);
System.out.println("There are a total of " + elements.size() + " items in the region");

 have over 100 cache items in the region "myRegion1".    But the 
elements.size() always returns 0.    WHY?   how can I resolve this?

By the way, I can successfully get back some region info by calling:
         List list = admin.buildCacheInfo(); 
and returns msg as below:

INFO: Cache Region - myRegion1
Cache Name: aerostat
Cache Type: 1
Cache Size: 0
Cache Misses (not found): 0
Cache Misses (expired): 0
Cache Hits (memory): 0
Cache Updates: 0
Cache Name: myRegion2
Cache Type: 1
Cache Size: 0
Cache Misses (not found): 0
Cache Misses (expired): 0
Cache Hits (memory): 0
Cache Updates: 0
INFO: There are 2 regions found

Any one has any clue on 2 questions:
1.) why does admin.buildElementInfo(myRegion1) not return any element info.
2.) why does the region info has 0s, even though I have tried to hit the cache many times?
3.) most critical -- what is the proper way to retrieve all keys in a region?

Thanks so much for any insight on it.

This message contains information that may be privileged or confidential and is the property
of the Capgemini Group. It is 
intended only for the person to whom it is addressed. If you are not the intended recipient,
you are not authorized to 
read, print, retain, copy, disseminate, distribute, or use this message or any part thereof.
If you receive this message 
in error, please notify the sender immediately and delete all copies of this message.

To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message