public void set(int key, int value) {
    	LRUnit lrunit =  cacheMap.get(key);
    	if(lrunit!=null){// found ,just set new value
    		lrunit.setValue(value);
    		lrunit.flushDate();
    		return;
    	}else{// not found
    		int len = cacheMap.size();
    		if(len<capacity){// not reach capacity,new one
    			cacheMap.put(key, new LRUnit(value,System.nanoTime() ) );
    			return;
    		}else{//reach capacity,use one of the min(used_count)
    			Iterator iter = cacheMap.entrySet().iterator();
    			LRUnit tmpLrunitP = null;
    			long oldestDate = 0;
    			long tmpDate = 0; //tmpLrunitP.getUsed_date();
    			int oldestDateKey = -1;
    			int tmpKey = -1;
    			int i=0;
    			while (iter.hasNext()) {
    				Map.Entry entry = (Map.Entry) iter.next();
    				tmpKey = (int) entry.getKey();
    				tmpLrunitP = (LRUnit) entry.getValue();
    				tmpDate =  tmpLrunitP.getUsed_date();
    				
    				if(i==0){
    					oldestDate=tmpDate;
    					oldestDateKey = tmpKey;
    	    		}else{
    	    			if(  oldestDate > tmpDate  ){//tmpDate <minUsedCount ){
    	    				oldestDate=tmpDate;
        					oldestDateKey = tmpKey;
    	    			}
    	    		}
    				i++;
    			}

//System.out.println("Remove Key:"+oldestDateKey);    			
    			tmpLrunitP = cacheMap.remove(oldestDateKey);//cacheMap.get(minUsedKey);
    			tmpLrunitP.setValue(value);
    			tmpLrunitP.flushDate();
    			cacheMap.put(key,tmpLrunitP);
    			return;
    		}
    	}
    }