Addメソッドがすでに存在する場合は失敗することをどこでも読んだことがありますが、例外をスローしますか、それともサイレントに失敗しますか?
まだ存在していないはずのマルチスレッドWebアプリケーションを作成していますが、キャッシュを上書きすると問題が発生するため、Insertメソッドを使用できません。
これは私にできることでしょうか:
try
{
HttpContext.Current.Cache.Add("notifications", notifications, null,
System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromHours(8),
System.Web.Caching.CacheItemPriority.High, null);
}
catch
{
//do whatever if notifications already exist
}
答えてくれてありがとう:)