Как программно загрузить определенный файл для конфигурации клиента NCache?
Не желая оставлять client.ncconf
лежа в стороне мой exe
Я хотел бы иметь возможность указать путь к client.ncconf
файл программно. Как я могу? Я использую NCache 4.4SP1 с открытым исходным кодом.
Методы, которые я использую, в основном Web.Caching.NCache.InitializeCache
а также Cache.Get
,
1 ответ
Он выбирает конфиг из %NCHOME%
InstallDir/config
, Просто добавьте следующее в ваши AppSettings
<add key="InstallDir" value="C:\temp"/>
Кроме того, все конфигурации клиента могут быть определены программно с помощью CacheInitParams
, Вы можете
namespace Alachisoft.NCache.Web.Caching
{
public class CacheInitParams : ICloneable
{
public CacheInitParams();
public string BindIP { get; set; }
public ClientCacheSyncMode ClientCacheSyncMode { get; set; }
public int ClientRequestTimeOut { get; set; }
public int CommandRetries { get; set; }
public int CommandRetryInterval { get; set; }
public int ConnectionRetries { get; set; }
public int ConnectionTimeout { get; set; }
public string DefaultReadThruProvider { get; set; }
public string DefaultWriteThruProvider { get; set; }
public bool LoadBalance { get; set; }
public CacheMode Mode { get; set; }
[Obsolete("This property is deprecated. Please use the 'ServerList' property instead.", false)]
public int Port { get; set; }
public SecurityParams PrimaryUserCredentials { get; set; }
public int RetryConnectionDelay { get; set; }
public int RetryInterval { get; set; }
public SecurityParams SecondaryUserCredentials { get; set; }
[Obsolete("This property is deprecated. Please use the 'ServerList' property instead.", false)]
public string Server { get; set; }
public CacheServerInfo[] ServerList { get; set; }
public object Clone();
}
}