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 readonly Regex _multiPartRegex = new Regex(@"\.a[a-z]{2}"); // A bit crude
private IDiskCacheSingleton _disk; private IDiskCacheSingleton _disk;
private IDatabase _cache; //private IDatabase _cache;
public MasterListBuilder(IDiskCacheSingleton disk, IDistributedCache cache) public MasterListBuilder(IDiskCacheSingleton disk)
{ {
BasePathLength = BasePathLength =
@"MagiRecoStatic/magica/resource/download/asset/master/resource/".Length; @"MagiRecoStatic/magica/resource/download/asset/master/resource/".Length;
_cache = ((RedisCache)cache).GetConnection().GetDatabase(); // _cache = ((RedisCache)cache).GetConnection().GetDatabase();
_disk = disk; _disk = disk;
} }

View file

@ -18,23 +18,25 @@ namespace KamihamaWeb.Services
public class MasterService: IMasterSingleton public class MasterService: IMasterSingleton
{ {
private IDatabase _cache { get; set; } // private IDatabase _cache { get; set; }
private IConfiguration _config { get; set; } private IConfiguration _config { get; set; }
private IRestSharpTransient _rest { get; set; } private IRestSharpTransient _rest { get; set; }
private IMasterListBuilder _builder { get; set; } private IMasterListBuilder _builder { get; set; }
public MasterService( public MasterService(
IDistributedCache cache, //IDistributedCache cache,
IConfiguration config, IConfiguration config,
IRestSharpTransient rest, IRestSharpTransient rest,
IMasterListBuilder builder IMasterListBuilder builder
) : this(Guid.NewGuid(), cache, config, rest, builder) ) : this(Guid.NewGuid(),
//cache,
config, rest, builder)
{ {
} }
public MasterService( public MasterService(
Guid guid, Guid guid,
IDistributedCache cache, //IDistributedCache cache,
IConfiguration config, IConfiguration config,
IRestSharpTransient rest, IRestSharpTransient rest,
IMasterListBuilder builder IMasterListBuilder builder
@ -42,7 +44,7 @@ namespace KamihamaWeb.Services
{ {
Guid = guid; Guid = guid;
_config = config; _config = config;
_cache = ((RedisCache) cache).GetConnection().GetDatabase(); //_cache = ((RedisCache) cache).GetConnection().GetDatabase();
_rest = rest; _rest = rest;
_builder = builder; _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. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddStackExchangeRedisCache(action => /*services.AddStackExchangeRedisCache(action =>
{ {
action.InstanceName = Configuration["DatabaseConfiguration:RedisInstanceName"]; action.InstanceName = Configuration["DatabaseConfiguration:RedisInstanceName"];
action.Configuration = Configuration["DatabaseConfiguration:RedisConfiguration"]; action.Configuration = Configuration["DatabaseConfiguration:RedisConfiguration"];
}); });*/
services.AddHttpCacheHeaders(); services.AddHttpCacheHeaders();
services.AddControllersWithViews(); services.AddControllersWithViews();