Esempio n. 1
0
 public void put(K name, V obj) {
   if (name == null) {
     throw new IllegalArgumentException("No null cache key accepted");
   }
   if (liveTimeMillis != 0) {
     long expirationTime =
         liveTimeMillis > 0 ? System.currentTimeMillis() + liveTimeMillis : Long.MAX_VALUE;
     state.put(expirationTime, name, obj);
   }
 }
Esempio n. 2
0
 public void putMap(Map<? extends K, ? extends V> objs) {
   if (objs == null) {
     throw new IllegalArgumentException("No null map accepted");
   }
   long expirationTime =
       liveTimeMillis > 0 ? System.currentTimeMillis() + liveTimeMillis : Long.MAX_VALUE;
   for (Serializable name : objs.keySet()) {
     if (name == null) {
       throw new IllegalArgumentException("No null cache key accepted");
     }
   }
   for (Map.Entry<? extends K, ? extends V> entry : objs.entrySet()) {
     state.put(expirationTime, entry.getKey(), entry.getValue());
   }
 }
Esempio n. 3
0
 public void assertConsistent() {
   state.assertConsistency();
 }
Esempio n. 4
0
 public V remove(Serializable name) {
   if (name == null) {
     throw new IllegalArgumentException("No null cache key accepted");
   }
   return state.remove(name);
 }
Esempio n. 5
0
 public V get(Serializable name) {
   if (name == null) {
     return null;
   }
   return state.get(name);
 }