public static Cache CreateFromProperties(IDictionary properties, Configuration.Dom.CacheConfig config, bool twoPhaseInitialization) { Cache cache = new Cache(); cache.Configuration = config; cache.Initialize(properties, true, twoPhaseInitialization); return(cache); }
/// <summary> /// Clona a instancia. /// </summary> /// <returns></returns> public object Clone() { CacheConfig config = new CacheConfig(); config.Name = (this.Name != null) ? ((string)this.Name.Clone()) : null; config._cacheType = this._cacheType; config.InProc = this.InProc; config.ConfigID = this.ConfigID; config.Cleanup = (this.Cleanup != null) ? ((Cleanup)this.Cleanup.Clone()) : null; config.LastModified = (this.LastModified != null) ? ((string)this.LastModified.Clone()) : null; config.Log = (this.Log != null) ? ((Log)this.Log.Clone()) : null; config.PerfCounters = (this.PerfCounters != null) ? ((PerfCounters)this.PerfCounters.Clone()) : null; config.Storage = (this.Storage != null) ? ((Storage)this.Storage.Clone()) : null; config.EvictionPolicy = (this.EvictionPolicy != null) ? ((EvictionPolicy)this.EvictionPolicy.Clone()) : null; config._backingSource = (this._backingSource != null) ? ((BackingSource)this._backingSource.Clone()) : null; config._cacheloader = (this._cacheloader != null) ? ((CacheLoader)this._cacheloader.Clone()) : null; config.Compression = (this.Compression != null) ? ((Compression)this.Compression.Clone()) : null; config.QueryIndices = (this.QueryIndices != null) ? ((QueryIndex)this.QueryIndices.Clone()) : null; config.DataSharing = (this.DataSharing != null) ? ((DataSharing)this.DataSharing.Clone()) : null; config.Notifications = (this.Notifications != null) ? ((Notifications)this.Notifications.Clone()) : null; config.CompactSerialization = (this.CompactSerialization != null) ? ((CompactSerialization)this.CompactSerialization.Clone()) : null; return(config); }
/// <summary> /// Cria o cache com base em um texto com as as configurações das propriedades. /// </summary> /// <param name="propertyString"></param> /// <param name="config"></param> /// <param name="twoPhaseInitialization"></param> /// <returns></returns> public static Cache CreateFromPropertyString(string propertyString, Configuration.Dom.CacheConfig config, bool twoPhaseInitialization) { ConfigReader reader = new PropsConfigReader(propertyString); return(CreateFromProperties(reader.Properties, config, twoPhaseInitialization)); }