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