internal void UpdateCache(Type sourceType, Type targetType, bool isConvertable, IConversionAttempt conversionAttempt) { if (this.IsCacheEnabled == false) { return; } lock (this.syncObj) { this.ReduceCacheSize(this.MaxCacheSize - 1); // -1 because we are about to insert a new item var key = new KeyValuePair <Type, Type>(sourceType, targetType); var value = new WeightedCacheResult(isCached: true, isConvertable: isConvertable, conversionAttempt: conversionAttempt); this.cache[key] = value; } }
public WeightedCacheResult(bool isCached, bool isConvertable, IConversionAttempt conversionAttempt) : base(isCached, isConvertable, conversionAttempt) { }
public CacheResult(bool isCached, bool isConvertable, IConversionAttempt conversionAttempt) : this(isCached) { this.IsConvertable = isConvertable; this.ConversionAttempt = conversionAttempt; }
internal void UpdateCache(Type sourceType, Type targetType, bool isConvertable, IConversionAttempt conversionAttempt) { if (this.IsCacheEnabled == false) { return; } lock (this.syncObj) { this.ReduceCacheSize(this.MaxCacheSize - 1); // -1 because we are about to insert a new item var key = new KeyValuePair<Type, Type>(sourceType, targetType); var value = new WeightedCacheResult(isCached: true, isConvertable: isConvertable, conversionAttempt: conversionAttempt); this.cache[key] = value; } }