Added a basic cache service to handle interations with the underlying cache implementation. Refactored some code to be more robust.

This commit is contained in:
Joseph Milazzo 2021-01-09 16:14:28 -06:00
parent 59a4921ba9
commit cd8a1d2892
8 changed files with 149 additions and 34 deletions

View file

@ -19,6 +19,7 @@ namespace API.Extensions
services.AddScoped<ITaskScheduler, TaskScheduler>();
services.AddScoped<IUserRepository, UserRepository>();
services.AddScoped<ITokenService, TokenService>();
services.AddScoped<ICacheService, CacheService>();
services.AddScoped<ISeriesRepository, SeriesRepository>();
services.AddScoped<IDirectoryService, DirectoryService>();
services.AddScoped<ILibraryRepository, LibraryRepository>();

View file

@ -0,0 +1,19 @@
using System.IO;
using System.IO.Compression;
using System.Linq;
namespace API.Extensions
{
public static class ZipArchiveExtensions
{
/// <summary>
/// Checks if archive has one or more files. Excludes directory entries.
/// </summary>
/// <param name="archive"></param>
/// <returns></returns>
public static bool HasFiles(this ZipArchive archive)
{
return archive.Entries.Any(x => Path.HasExtension(x.FullName));
}
}
}