Skip to content

Instantly share code, notes, and snippets.

@ddeaguiar
Created April 8, 2009 16:37
Show Gist options
  • Save ddeaguiar/91856 to your computer and use it in GitHub Desktop.
Save ddeaguiar/91856 to your computer and use it in GitHub Desktop.
//it requires reflection...how unfortunate.
public List getKeys() {
Cache cache = getCacheAdministrator().getCache();
try {
Field mapField = cache.getClass().getDeclaredField("cacheMap");
mapField.setAccessible(true);
LRUCache map = (LRUCache) mapField.get(cache);
return new ArrayList(map.keySet());
} catch (Exception e) {
log.error(e);
return new ArrayList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment