Exemple #1
0
 private static long getEvictionCriteriaValue(
     Record record, MapConfig.EvictionPolicy evictionPolicy) {
   long value;
   switch (evictionPolicy) {
     case LRU:
     case LFU:
       value = record.getEvictionCriteriaNumber();
       break;
     default:
       throw new IllegalArgumentException(
           "Not an appropriate eviction policy [" + evictionPolicy + ']');
   }
   return value;
 }
Exemple #2
0
 protected void increaseRecordEvictionCriteriaNumber(
     Record record, MapConfig.EvictionPolicy evictionPolicy) {
   switch (evictionPolicy) {
     case LRU:
       ++lruAccessSequenceNumber;
       record.setEvictionCriteriaNumber(lruAccessSequenceNumber);
       break;
     case LFU:
       record.setEvictionCriteriaNumber(record.getEvictionCriteriaNumber() + 1L);
       break;
     case NONE:
       break;
     default:
       throw new IllegalArgumentException(
           "Not an appropriate eviction policy [" + evictionPolicy + ']');
   }
 }