예제 #1
0
 /**
  * Gets the secondary keys that are registered with the class in CacheMap.
  *
  * @param clazz the class
  * @param a the array to receive the keys.
  * @return the secondary keys.
  */
 public K[] getKeys(Class<?> clazz, K[] a) {
   Cache<K, T> cache = getCache(clazz);
   if (cache != null) {
     Set<K> set = cache.keySet();
     return set.toArray(a);
   } else {
     return a;
   }
 }
예제 #2
0
 /**
  * Remove all registrations for the designated class.
  *
  * @param clazz the class
  */
 @SuppressWarnings("unchecked")
 public void remove(Class<?> clazz) {
   Cache<K, T> cache = getCache(clazz);
   if (cache != null) {
     Object[] keys = cache.keySet().toArray();
     for (Object context : keys) {
       cache.setObject((K) context, null);
     }
   }
   _cache.remove(clazz);
 }