Source/NFX/DataAccess/Cache/ComplexKeyHashingStrategy.cs
/// <summary>
/// Default implementation that converts complex object to uint64 key.
/// The default implementation returns the hashcode of the object unless the key is string
/// in which case it calls DefaultStringKeyToCacheKey() or IULongHashProvider(GDID and parcels).
/// The function is not deterministic due to the use of .GetHashCode() that may change between release for some objects (depends on object implementation),
/// so the returned value should not be persisted
/// </summary>
Default implementation that converts complex object to uint64 key.
The default implementation returns the hashcode of the object unless the key is string
in which case it calls DefaultStringKeyToCacheKey() or IULongHashProvider(GDID and parcels).
The function is not deterministic due to the use of .GetHashCode() that may change between release for some objects (depends on object implementation),
so the returned value should not be persisted
Default implementation that converts complex object to uint64 key . The default implementation returns the hashcode of the object unless the key is string in which case it calls DefaultStringKeyToCacheKey () or IULongHashProvider ( GDID and parcels ) . The function is not deterministic due to the use of . GetHashCode () that may change between release for some objects ( depends on object implementation ) so the returned value should not be persisted
public static ulong DefaultComplexKeyToCacheKey(object key)
        {
            if (key==null) return 0;
            if (key is string)
              return DefaultStringKeyToCacheKey((string)key);
            if (key is IDistributedStableHashProvider)
              return ((IDistributedStableHashProvider)key).GetDistributedStableHash();
            return (ulong)key.GetHashCode();
        }
public static ulong DefaultComplexKeyToCacheKey ( object key ) { if ( key == null ) return 0 ; if ( key is string ) return DefaultStringKeyToCacheKey ( ( string ) key ) ; if ( key is IDistributedStableHashProvider ) return ( ( IDistributedStableHashProvider ) key ) . GetDistributedStableHash ( ) ; return ( ulong ) key . GetHashCode ( ) ; }
Default implementation that converts complex object to uint64 key.
Default implementation that converts complex object to uint64 key .
//covers GDID and parcels as well
key
object