Implemented hybrid cache for user sessions, api keys and database provided settings. Cleaned up startup and adjusted caching option models for features
This commit is contained in:
@@ -2,5 +2,6 @@ namespace Moonlight.Api.Configuration;
|
||||
|
||||
public class ApiOptions
|
||||
{
|
||||
public int LookupCacheMinutes { get; set; } = 3;
|
||||
public TimeSpan LookupCacheL1Expiry { get; set; } = TimeSpan.FromSeconds(30);
|
||||
public TimeSpan LookupCacheL2Expiry { get; set; } = TimeSpan.FromMinutes(3);
|
||||
}
|
||||
6
Moonlight.Api/Configuration/CacheOptions.cs
Normal file
6
Moonlight.Api/Configuration/CacheOptions.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Moonlight.Api.Configuration;
|
||||
|
||||
public class CacheOptions
|
||||
{
|
||||
public bool EnableLayer2 { get; set; }
|
||||
}
|
||||
7
Moonlight.Api/Configuration/RedisOptions.cs
Normal file
7
Moonlight.Api/Configuration/RedisOptions.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Moonlight.Api.Configuration;
|
||||
|
||||
public class RedisOptions
|
||||
{
|
||||
public bool Enable { get; set; }
|
||||
public string ConnectionString { get; set; }
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Moonlight.Api.Configuration;
|
||||
|
||||
public class SessionOptions
|
||||
{
|
||||
public int ValidationCacheMinutes { get; set; } = 3;
|
||||
}
|
||||
@@ -2,5 +2,6 @@
|
||||
|
||||
public class SettingsOptions
|
||||
{
|
||||
public int CacheMinutes { get; set; } = 3;
|
||||
public TimeSpan LookupL1CacheTime { get; set; } = TimeSpan.FromMinutes(1);
|
||||
public TimeSpan LookupL2CacheTime { get; set; } = TimeSpan.FromMinutes(5);
|
||||
}
|
||||
7
Moonlight.Api/Configuration/UserOptions.cs
Normal file
7
Moonlight.Api/Configuration/UserOptions.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Moonlight.Api.Configuration;
|
||||
|
||||
public class UserOptions
|
||||
{
|
||||
public TimeSpan ValidationCacheL1Expiry { get; set; } = TimeSpan.FromSeconds(30);
|
||||
public TimeSpan ValidationCacheL2Expiry { get; set; } = TimeSpan.FromMinutes(3);
|
||||
}
|
||||
Reference in New Issue
Block a user