@Override
    public void put(String key, String value) {
        int setId = getSetId(key);
        for (KVCacheEntry e : data.get(setId).entry) {
        	if (e.key.equals(key)) {
        		e.value = value;
        		e.isRef = true;
        		return;
        	}
        }
        // not in cache
        if (data.get(setId).entry.size() == maxElemsPerSet) {
        	// is full
        	for (;;) {
	        	for (KVCacheEntry e : data.get(setId).entry) {
	        		if (e.isRef == false) {
	        			e.key = key;
	        			e.value = value;
	        			e.isRef = false;
	        			return;
	        		}
	        		else
	        			e.isRef = false;
	        	}
        	}
        }
        else {
        	data.get(setId).entry.add(new KVCacheEntry(key , value , false));
        }
    }