using Longbow.Cache; using Longbow.Data; using System; using System.Collections.Generic; using System.Collections.Specialized; namespace Bootstrap.DataAccess { /// /// /// public static class ExceptionsHelper { /// /// /// public const string RetrieveExceptionsDataKey = "ExceptionHelper-RetrieveExceptions"; /// /// /// /// /// /// public static void Log(Exception ex, NameValueCollection additionalInfo) { var ret = DbAdapterManager.Create().Log(ex, additionalInfo); if (ret) CacheManager.Clear(RetrieveExceptionsDataKey); } /// /// 查询一周内所有异常 /// /// public static IEnumerable RetrieveExceptions() => CacheManager.GetOrAdd(RetrieveExceptionsDataKey, key => DbAdapterManager.Create().RetrieveExceptions()); } }