我不希望将client.ncconf
放在我的exe
旁边,我希望能够以编程方式指定client.ncconf
文件的路径。我怎么样?我正在使用NCache 4.4SP1开源。
我使用的方法主要是Web.Caching.NCache.InitializeCache
和Cache.Get
。
答案 0 :(得分: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();
}
}