asp.net(C#)で複数のサーバーでアプリケーションキャッシュをサポートしていますか。アプリケーション変数が複数のサーバー (Web ファーム) でサポートされていないことは知っていますが、アプリケーション キャッシュはどうでしょうか? 複数のサーバーを使用する場合、値にアクセスする際に問題が発生したり、アプリケーションキャッシュに値を保存する価値がなかったりすることはありますか? (データベースの保存には適していません。より多くの負荷がかかります)。ここで私はコードを使用しています
HybridDictionary dicApplicationVariable = new HybridDictionary();
if (HttpContext.Current.Cache["dicApplicationVariable"] != null)
{
dicApplicationVariable = (HybridDictionary)HttpContext.Current.Cache["dicApplicationVariable"];
if (dicApplicationVariable.Contains(dtUserLogin.Rows[0]["Id"]))
{
dicApplicationVariable.Remove(dtUserLogin.Rows[0]["Id"]);
dicApplicationVariable.Add(dtUserLogin.Rows[0]["Id"], LogginSessionID);
}
else
{
dicApplicationVariable.Add(dtUserLogin.Rows[0]["Id"], LogginSessionID);
}
}
else
{
dicApplicationVariable.Add(dtUserLogin.Rows[0]["Id"], LogginSessionID);
HttpContext.Current.Cache["dicApplicationVariable"] = dicApplicationVariable;
}