public void set(int key, int value) {
    	
    	if( get(key) != -1) {
            dataMap.get(key).val = value;
            return;
        }else{
        	if(dataMap.size()>=cacheCap){
        		DataPair newData = new DataPair(key,value);
        		
        		dataMap.remove(tail.prev.key);
        		dataMap.put(key, newData);
        		
        		//add new add to head
        		newData.prev = head;
        		newData.next = head.next;
        		head.next.prev = newData;
        		head.next = newData;
        		
        		
        		//remove tail's prev point
        		tail.prev.prev.next = tail;
        		tail.prev = tail.prev.prev;
        		
        		
        		
        		
        	}else{
        		DataPair newData = new DataPair(key,value);
        		head.next.prev = newData;
        		newData.next = head.next;
        		newData.prev = head;
        		head.next = newData;
        		
        		dataMap.put(key, newData);
        		
        	}
        }
    	
    }