Source/NFX/DataAccess/Cache/ComplexKeyHashingStrategy.cs
/// <summary>
/// Override to put a value keyed on a non-uint64 scalar into cache. Returns table.Put() result
/// </summary>
Override to put a value keyed on a non-uint64 scalar into cache.
Override to put a value keyed on a non - uint64 scalar into cache .
public virtual bool Put(string tableName, object key, object value, int maxAgeSec = 0, int priority = 0, DateTime? absoluteExpirationUTC = null)
        {
            if (key==null)
             throw new NFXException(StringConsts.ARGUMENT_ERROR + GetType().FullName+"Put(key=null)");
            ulong id = ComplexKeyToCacheKey(key);
            var tbl = Store[tableName];
            int cnt = 0;
            while(cnt<MAX_CACHE_CHAIN_LENGTH)
            {
              var crec = tbl.Get(id);
              if (crec==null) break;
              if (key.Equals(crec.Metadata)) break;
              id++;
              cnt++;
            }
            CacheRec rec;
            var result = tbl.Put(id, value, out rec, maxAgeSec, priority, absoluteExpirationUTC);
            rec.Metadata = key;
            return result;
        }
public virtual bool Put ( string tableName , object key , object value , int maxAgeSec = 0 , int priority = 0 , DateTime ? absoluteExpirationUTC = null ) { 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 crec = tbl . Get ( id ) ; if ( crec == null ) break ; if ( key . Equals ( crec . Metadata ) ) break ; id ++ ; cnt ++ ; } CacheRec rec ; var result = tbl . Put ( id , value , out rec , maxAgeSec , priority , absoluteExpirationUTC ) ; rec . Metadata = key ; return result ; }
Override to put a value keyed on a non-uint64 scalar into cache.
Override to put a value keyed on a non - uint64 scalar into cache .
//key collision
tableName
string
key
object
value
object
maxAgeSec
int
priority
int
absoluteExpirationUTC
DateTime?