#1513 Added the update available icon

This commit is contained in:
tidusjar 2017-09-28 20:25:33 +01:00
commit f689af82f0
14 changed files with 104 additions and 160 deletions

View file

@ -6,6 +6,6 @@ namespace Ombi.Helpers
{
public static class CacheKeys
{
public const string RadarrCacher = nameof(RadarrCacher);
public const string Update = nameof(Update);
}
}

View file

@ -0,0 +1,54 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2017 Jamie Rees
// File: MemoryCacheHelper.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using Microsoft.Extensions.Caching.Memory;
namespace Ombi.Helpers
{
public static class MemoryCacheHelper
{
public static IMemoryCache TryAdd(this IMemoryCache cache, object cacheObject, TimeSpan slidingExpiration)
{
object cachedObject;
if (!cache.TryGetValue(CacheKeys.Update, out cachedObject))
{
// Key not in cache, so get data.
// Set cache options.
var cacheEntryOptions = new MemoryCacheEntryOptions()
.SetSlidingExpiration(slidingExpiration);
// Save data in cache.
cache.Set(CacheKeys.Update, cacheObject, cacheEntryOptions);
}
return cache;
}
}
}

View file

@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="EasyCrypto" Version="3.3.2" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="System.Security.Claims" Version="4.3.0" />