예제 #1
0
 protected virtual void Dispose(bool disposing) // LUCENENET specific - implemented proper dispose pattern.
 {
     if (disposing)
     {
         if (isDisposed)
         {
             return;
         }
         UninterruptableMonitor.Enter(syncLock);
         try
         {
             if (isDisposed)
             {
                 return;
             }
             if (cache != null)
             {
                 cache.Clear();
                 cache = null;
             }
             isDisposed = true;
         }
         finally
         {
             UninterruptableMonitor.Exit(syncLock);
         }
     }
 }
예제 #2
0
 internal NameInt32CacheLru(int limit)
 {
     this.cache = new NameCacheLru <FacetLabel>(
         limit,
         (name) => name,
         (name, prefixLength) => name.Subpath(prefixLength));
 }
예제 #3
0
 internal NameHashInt32CacheLru(int limit)
 {
     this.cache = new NameCacheLru <long>(
         limit,
         (name) => name.Int64HashCode(),
         (name, prefixLength) => name.Subpath(prefixLength).Int64HashCode());
 }
예제 #4
0
 /// <summary>
 /// Creates this with the specified method.
 /// </summary>
 public LruTaxonomyWriterCache(int cacheSize, LRUType lruType)
 {
     // TODO (Facet): choose between NameHashIntCacheLRU and NameIntCacheLRU.
     // For guaranteed correctness - not relying on no-collisions in the hash
     // function, NameIntCacheLRU should be used:
     // On the other hand, NameHashIntCacheLRU takes less RAM but if there
     // are collisions (which we never found) two different paths would be
     // mapped to the same ordinal...
     if (lruType == LRUType.LRU_HASHED)
     {
         this.cache = new NameHashInt32CacheLru(cacheSize);
     }
     else
     {
         this.cache = new NameInt32CacheLru(cacheSize);
     }
 }
예제 #5
0
 protected virtual void Dispose(bool disposing) // LUCENENET specific - implemented proper dispose pattern.
 {
     if (disposing)
     {
         if (isDisposed)
         {
             return;
         }
         lock (syncLock)
         {
             if (isDisposed)
             {
                 return;
             }
             if (cache != null)
             {
                 cache.Clear();
                 cache = null;
             }
             isDisposed = true;
         }
     }
 }