Remove redis requirement

This commit is contained in:
Neo 2020-11-01 20:57:08 +00:00
parent 664042ec44
commit 0674d906ee
3 changed files with 12 additions and 10 deletions

View File

@ -22,14 +22,14 @@ namespace KamihamaWeb.Services
private readonly Regex _multiPartRegex = new Regex(@"\.a[a-z]{2}"); // A bit crude
private IDiskCacheSingleton _disk;
private IDatabase _cache;
//private IDatabase _cache;
public MasterListBuilder(IDiskCacheSingleton disk, IDistributedCache cache)
public MasterListBuilder(IDiskCacheSingleton disk)
{
BasePathLength =
@"MagiRecoStatic/magica/resource/download/asset/master/resource/".Length;
_cache = ((RedisCache)cache).GetConnection().GetDatabase();
// _cache = ((RedisCache)cache).GetConnection().GetDatabase();
_disk = disk;
}

View File

@ -18,23 +18,25 @@ namespace KamihamaWeb.Services
public class MasterService: IMasterSingleton
{
private IDatabase _cache { get; set; }
// private IDatabase _cache { get; set; }
private IConfiguration _config { get; set; }
private IRestSharpTransient _rest { get; set; }
private IMasterListBuilder _builder { get; set; }
public MasterService(
IDistributedCache cache,
//IDistributedCache cache,
IConfiguration config,
IRestSharpTransient rest,
IMasterListBuilder builder
) : this(Guid.NewGuid(), cache, config, rest, builder)
) : this(Guid.NewGuid(),
//cache,
config, rest, builder)
{
}
public MasterService(
Guid guid,
IDistributedCache cache,
//IDistributedCache cache,
IConfiguration config,
IRestSharpTransient rest,
IMasterListBuilder builder
@ -42,7 +44,7 @@ namespace KamihamaWeb.Services
{
Guid = guid;
_config = config;
_cache = ((RedisCache) cache).GetConnection().GetDatabase();
//_cache = ((RedisCache) cache).GetConnection().GetDatabase();
_rest = rest;
_builder = builder;

View File

@ -28,11 +28,11 @@ namespace KamihamaWeb
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddStackExchangeRedisCache(action =>
/*services.AddStackExchangeRedisCache(action =>
{
action.InstanceName = Configuration["DatabaseConfiguration:RedisInstanceName"];
action.Configuration = Configuration["DatabaseConfiguration:RedisConfiguration"];
});
});*/
services.AddHttpCacheHeaders();
services.AddControllersWithViews();