public override bool Equals(object o) { if (o == null || !(o is FactoryCache.Key)) { return(false); } FactoryCache.Key key = (FactoryCache.Key)o; return(this.options == key.options && this.pattern.Equals(key.pattern)); }
public void Add(string pattern, RegexOptions options, IMachineFactory factory) { lock (this) { FactoryCache.Key key = new FactoryCache.Key(pattern, options); this.Cleanup(); this.factories[key] = factory; this.mru_list.Use(key); } }
public IMachineFactory Lookup(string pattern, RegexOptions options) { lock (this) { FactoryCache.Key key = new FactoryCache.Key(pattern, options); if (this.factories.Contains(key)) { this.mru_list.Use(key); return((IMachineFactory)this.factories[key]); } } return(null); }