* @param reader the index reader from where the document number was read.
* @param n the document number.
*/
void put(String uuid, CachingIndexReader reader, int n)
{
LRUMap cacheSegment = docNumbers[getSegmentIndex(uuid.charAt(0))];
//UUID key = UUID.fromString(uuid);
String key = uuid;
synchronized (cacheSegment)
{
Entry e = (Entry)cacheSegment.get(key);
if (e != null)
{
// existing entry
// ignore if reader is older than the one in entry
if (reader.getCreationTick() <= e.creationTick)
{
if (log.isDebugEnabled())
{
log.debug("Ignoring put(). New entry is not from a newer reader. " + "existing: " + e.creationTick
+ ", new: " + reader.getCreationTick());
}
e = null;
}
}
else
{
// entry did not exist
e = new Entry(reader.getCreationTick(), n);
}
if (e != null)
{
cacheSegment.put(key, e);
}
}
}