Source/NFX/DataAccess/Cache/ComplexKeyHashingStrategy.cs
/// <summary>
/// Override to remove an item keyed on a non-uint64 scalar from cache. Returns true if remove found and removed item from table
/// </summary>
Override to remove an item keyed on a non-uint64 scalar from cache. Returns true if remove found and removed item from table
Override to remove an item keyed on a non - uint64 scalar from cache . Returns true if remove found and removed item from table
public virtual bool Remove(string tableName, object key)
        {
          if (key==null)
             throw new NFXException(StringConsts.ARGUMENT_ERROR + GetType().FullName+"Remove(key=null)");
          ulong id = ComplexKeyToCacheKey(key);
          var tbl = Store[tableName];
          int cnt = 0;
          bool removed = false;
          while(cnt<MAX_CACHE_CHAIN_LENGTH)
          {
            var result = tbl.Get(id);
            if (result!=null)
            {
             if (key.Equals(result.Metadata))
             {
               removed = tbl.Remove(id);
               break;
             }
            }
            id++;
            cnt++;
          }
          if (removed)
              System.Threading.Interlocked.Increment(ref tbl.stat_ComplexHitCount);
          else
              System.Threading.Interlocked.Increment(ref tbl.stat_ComplexMissCount);
          return removed;
        }
public virtual bool Remove ( string tableName , object key ) { if ( key == null ) throw new NFXException ( StringConsts . ARGUMENT_ERROR + GetType ( ) . FullName + " " ) ; ulong id = ComplexKeyToCacheKey ( key ) ; var tbl = Store [ tableName ] ; int cnt = 0 ; bool removed = false ; while ( cnt < MAX_CACHE_CHAIN_LENGTH ) { var result = tbl . Get ( id ) ; if ( result != null ) { if ( key . Equals ( result . Metadata ) ) { removed = tbl . Remove ( id ) ; break ; } } id ++ ; cnt ++ ; } if ( removed ) System . Threading . Interlocked . Increment ( ref tbl . stat_ComplexHitCount ) ; else System . Threading . Interlocked . Increment ( ref tbl . stat_ComplexMissCount ) ; return removed ; }
Override to remove an item keyed on a non-uint64 scalar from cache.
Override to remove an item keyed on a non - uint64 scalar from cache .
//key collision
tableName
string
key
object