Madusudanan
Madusudanan

Reputation: 1017

Getting keys from JCS Cache

I am using JCS cache for performance enhancement.There is an issue when I need to maintain a set of keys because the type of storage I use is generally offline storage to the disk. Is there a way to get the set of keys alone from the cache as I can with a hashmap,so that I can automate the process of getting the data from the cache,since I dont care about what kind of data comes out of cache because the metadata of the object is stored within the cache object itself.

Upvotes: 1

Views: 2448

Answers (2)

bachr
bachr

Reputation: 6006

You can get an array of keys by accessing the MemoryCache of the CompositeCache instance of your cache, this way: CompositeCacheManager.getInstance().getCache(cache_name).getMemoryCache().getKeyArray()

Upvotes: 1

Madusudanan
Madusudanan

Reputation: 1017

Resolved it myself,

In a group cache access,using putInGroup and getFromGroup there is a method getGroupKeys(groupname),which enables us to get the keys alone from the group within the cache region.The API documentation will greatly help in this case.

http://commons.apache.org/jcs/apidocs/index.html

Upvotes: 2

Related Questions