private bool AddLabel(HashArray a, FacetLabel label, int hash, int ordinal) { int index = CompactLabelToOrdinal.IndexFor(hash, a.offsets.Length); int offset = a.offsets[index]; if (offset == 0) { a.offsets[index] = this.labelRepository.Length; CategoryPathUtils.Serialize(label, labelRepository); a.cids[index] = ordinal; return true; } return false; }
public virtual bool Put(FacetLabel categoryPath, int ordinal) { @lock.AcquireWriterLock(LockTimeOut); try { cache.AddLabel(categoryPath, ordinal); // Tell the caller we didn't clear part of the cache, so it doesn't // have to flush its on-disk index now return(false); } finally { @lock.ReleaseWriterLock(); } }