1

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.

Madusudanan
  • 1,017
  • 1
  • 15
  • 36

2 Answers2

2

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

Madusudanan
  • 1,017
  • 1
  • 15
  • 36
  • but is there a way to get the list of all keys in the cache (i.e. not just in a given group) – bachr Apr 15 '14 at 10:24
1

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()

bachr
  • 5,780
  • 12
  • 57
  • 92