mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-14 01:02:57 -07:00
Add the Issue Reporting functionality (#1811)
* Added issuesreporting and the ability to add categories to the UI * Added lazy loading!
This commit is contained in:
parent
438f56eceb
commit
246f1c07cf
109 changed files with 2905 additions and 526 deletions
|
@ -5,7 +5,6 @@ using Ombi.Core.Settings;
|
|||
using Ombi.Helpers;
|
||||
using Ombi.Store.Entities;
|
||||
using Ombi.Store.Repository;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace Ombi.Settings.Settings
|
||||
{
|
||||
|
@ -13,7 +12,7 @@ namespace Ombi.Settings.Settings
|
|||
where T : Models.Settings, new()
|
||||
{
|
||||
|
||||
public SettingsService(ISettingsRepository repo, IMemoryCache cache)
|
||||
public SettingsService(ISettingsRepository repo, ICacheService cache)
|
||||
{
|
||||
Repo = repo;
|
||||
EntityName = typeof(T).Name;
|
||||
|
@ -23,13 +22,12 @@ namespace Ombi.Settings.Settings
|
|||
private ISettingsRepository Repo { get; }
|
||||
private string EntityName { get; }
|
||||
private string CacheName => $"Settings{EntityName}";
|
||||
private readonly IMemoryCache _cache;
|
||||
private readonly ICacheService _cache;
|
||||
|
||||
public T GetSettings()
|
||||
{
|
||||
return _cache.GetOrCreate(CacheName, entry =>
|
||||
return _cache.GetOrAdd(CacheName, () =>
|
||||
{
|
||||
entry.AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(2);
|
||||
var result = Repo.Get(EntityName);
|
||||
if (result == null)
|
||||
{
|
||||
|
@ -43,14 +41,13 @@ namespace Ombi.Settings.Settings
|
|||
var model = obj;
|
||||
|
||||
return model;
|
||||
});
|
||||
}, DateTime.Now.AddHours(2));
|
||||
}
|
||||
|
||||
public async Task<T> GetSettingsAsync()
|
||||
{
|
||||
return await _cache.GetOrCreateAsync(CacheName, async entry =>
|
||||
return await _cache.GetOrAdd(CacheName, async () =>
|
||||
{
|
||||
entry.AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(2);
|
||||
var result = await Repo.GetAsync(EntityName);
|
||||
if (result == null)
|
||||
{
|
||||
|
@ -64,7 +61,7 @@ namespace Ombi.Settings.Settings
|
|||
var model = obj;
|
||||
|
||||
return model;
|
||||
});
|
||||
}, DateTime.Now.AddHours(2));
|
||||
}
|
||||
|
||||
public bool SaveSettings(T model)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue