Ao usar Cache.Add, é lançada uma exceção se a chave já existir ou falhar silenciosamente?
Eu li em todos os lugares que o método Add falha se ele já existe, mas ele lança uma exceção ou falha silenciosamente?
Eu estou escrevendo um aplicativo da web multithreaded onde ele já não deveria existir e causará problemas se eu sobrescrever o cache, portanto, não posso usar o método Insert.
Isso seria algo que eu poderia fazer:
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
}
Obrigado por qualquer resposta :)