Immutable value class representing a memoizer configuration - used for creating memoizer instances.
        public override bool Equals(object otherObject)
        {
            if (ReferenceEquals(null, otherObject))
            {
                return(false);
            }
            if (ReferenceEquals(this, otherObject))
            {
                return(true);
            }
            MemoizerConfiguration otherMemoizerConfiguration = otherObject as MemoizerConfiguration;

            if (otherMemoizerConfiguration == null)
            {
                return(false);
            }
            return(this.GetHashCode().Equals(otherMemoizerConfiguration.GetHashCode()));
        }
Example #2
0
 public Memoizer(MemoizerConfiguration memoizerConfig, bool shared)
 {
     this.functionToBeMemoized = memoizerConfig.Function;
     this.cacheItemPolicy      = CacheItemPolicyFactory.CreateCacheItemPolicy(memoizerConfig.ExpirationType, memoizerConfig.ExpirationValue, memoizerConfig.ExpirationTimeUnit);
     this.key = memoizerConfig.GetHashCode().ToString();
 }
Example #3
0
 public Memoizer(MemoizerConfiguration memoizerConfig) : this(memoizerConfig, shared : true)
 {
 }