Update organizzazione gerarchia cache REDIS

This commit is contained in:
Samuele Locatelli
2024-01-30 17:24:39 +01:00
parent 848434fd00
commit 4efb48abe7
3 changed files with 19 additions and 19 deletions
+7 -7
View File
@@ -173,7 +173,7 @@ namespace MagMan.Core.Services
/// <returns></returns>
public async Task<int> CustomerIdByToken(string RestToken)
{
string currKey = $"{Const.rKeyConfig}:Dict:Token2CustID";
string currKey = $"{Const.rKeyConfig}:Mserv:Dict:Token2CustID";
int answ = await RedisHashGetInt(currKey, RestToken);
return answ;
}
@@ -186,7 +186,7 @@ namespace MagMan.Core.Services
/// <returns></returns>
public bool CustomerIdByTokenSet(string RestToken, int CustId)
{
string currKey = $"{Const.rKeyConfig}:Dict:Token2CustID";
string currKey = $"{Const.rKeyConfig}:Mserv:Dict:Token2CustID";
bool fatto = RedisHashSet(currKey, RestToken, $"{CustId}");
return fatto;
}
@@ -198,7 +198,7 @@ namespace MagMan.Core.Services
/// <returns></returns>
public async Task<int> MainKeyByCustomer(int CustID)
{
string currKey = $"{Const.rKeyConfig}:Dict:Cust2MKey";
string currKey = $"{Const.rKeyConfig}:Mserv:Dict:Cust2MKey";
int answ = await RedisHashGetInt(currKey, $"{CustID}");
return answ;
}
@@ -211,7 +211,7 @@ namespace MagMan.Core.Services
/// <returns></returns>
public bool MainKeyByCustomerSet(int CustId, int MainKey)
{
string currKey = $"{Const.rKeyConfig}:Dict:Cust2MKey";
string currKey = $"{Const.rKeyConfig}:Mserv:Dict:Cust2MKey";
bool fatto = RedisHashSet(currKey, $"{CustId}", $"{MainKey}");
return fatto;
}
@@ -223,7 +223,7 @@ namespace MagMan.Core.Services
/// <returns></returns>
public async Task<int> MainKeyByToken(string RestToken)
{
string currKey = $"{Const.rKeyConfig}:Dict:Token2MKey";
string currKey = $"{Const.rKeyConfig}:Mserv:Dict:Token2MKey";
int answ = await RedisHashGetInt(currKey, RestToken);
return answ;
}
@@ -236,7 +236,7 @@ namespace MagMan.Core.Services
/// <returns></returns>
public bool MainKeyByTokenSet(string RestToken, int CustId)
{
string currKey = $"{Const.rKeyConfig}:Dict:Token2MKey";
string currKey = $"{Const.rKeyConfig}:Mserv:Dict:Token2MKey";
bool fatto = RedisHashSet(currKey, RestToken, $"{CustId}");
return fatto;
}
@@ -318,7 +318,7 @@ namespace MagMan.Core.Services
public bool ResetHashDict()
{
bool fatto = false;
string baseKey = $"{Const.rKeyConfig}:Dict";
string baseKey = $"{Const.rKeyConfig}:Mserv:Dict";
try
{
// salvo!
+6 -6
View File
@@ -61,7 +61,7 @@ namespace MagMan.Data.Admin.Services
List<AuthKeyModel>? dbResult = new List<AuthKeyModel>();
try
{
string currKey = $"{Const.rKeyConfig}:AuthKeyList:{CustomerId}";
string currKey = $"{Const.rKeyConfig}:Admin:AuthKeyList:{CustomerId}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
@@ -195,7 +195,7 @@ namespace MagMan.Data.Admin.Services
List<CustomerModel>? dbResult = new List<CustomerModel>();
try
{
string currKey = $"{Const.rKeyConfig}:CustomersList";
string currKey = $"{Const.rKeyConfig}:Admin:CustomersList";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
@@ -241,7 +241,7 @@ namespace MagMan.Data.Admin.Services
public async Task<int> CustomerIdByToken(string RestToken)
{
int answ = -1;
string currKey = $"{Const.rKeyConfig}:Dict:Token2CustID";
string currKey = $"{Const.rKeyConfig}:Admin:Dict:Token2CustID";
answ = RedisHashGetInt(currKey, RestToken);
if (answ <= 0)
{
@@ -332,7 +332,7 @@ namespace MagMan.Data.Admin.Services
List<MachineModel>? dbResult = new List<MachineModel>();
try
{
string currKey = $"{Const.rKeyConfig}:MachineList:{CustomerId}";
string currKey = $"{Const.rKeyConfig}:Admin:MachineList:{CustomerId}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
@@ -424,7 +424,7 @@ namespace MagMan.Data.Admin.Services
public async Task<int> MainKeyByCustomer(int CustID)
{
int answ = -1;
string currKey = $"{Const.rKeyConfig}:Dict:Cust2MKey";
string currKey = $"{Const.rKeyConfig}:Admin:Dict:Cust2MKey";
answ = RedisHashGetInt(currKey, $"{CustID}");
if (answ <= 0)
{
@@ -450,7 +450,7 @@ namespace MagMan.Data.Admin.Services
public async Task<int> MainKeyByToken(string RestToken)
{
int answ = -1;
string currKey = $"{Const.rKeyConfig}:Dict:Token2MKey";
string currKey = $"{Const.rKeyConfig}:Admin:Dict:Token2MKey";
answ = RedisHashGetInt(currKey, RestToken);
if (answ <= 0)
{
+6 -6
View File
@@ -116,7 +116,7 @@ namespace MagMan.Data.Tenant.Services
List<RawItemModel>? dbResult = new List<RawItemModel>();
try
{
string currKey = $"{Const.rKeyConfig}:ItemList:{nKey}";
string currKey = $"{Const.rKeyConfig}:{nKey}:ItemListAll";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
@@ -296,7 +296,7 @@ namespace MagMan.Data.Tenant.Services
try
{
string dType = withChild ? "MaterialsDtoFull" : "MaterialsDto";
string currKey = $"{Const.rKeyConfig}:{dType}:{nKey}";
string currKey = $"{Const.rKeyConfig}:{nKey}:{dType}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
@@ -435,8 +435,8 @@ namespace MagMan.Data.Tenant.Services
List<MaterialModel>? dbResult = new List<MaterialModel>();
try
{
string dType = withChild ? "MaterialsFull" : "Materials";
string currKey = $"{Const.rKeyConfig}:{dType}:{nKey}";
string dType = withChild ? "MaterModAllFull" : "MaterModAll";
string currKey = $"{Const.rKeyConfig}:{nKey}:{dType}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
@@ -494,7 +494,7 @@ namespace MagMan.Data.Tenant.Services
List<MaterialModel>? dbResult = new List<MaterialModel>();
try
{
string dType = withChild ? "MatInvFull" : "MatInv";
string dType = withChild ? "MaterModFiltAll" : "MaterModFilt";
string currKey = $"{Const.rKeyConfig}:{nKey}:{dType}:{matID}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
@@ -709,7 +709,7 @@ namespace MagMan.Data.Tenant.Services
List<ProjModel>? dbResult = new List<ProjModel>();
try
{
string currKey = $"{Const.rKeyConfig}:ProjList:{nKey}";
string currKey = $"{Const.rKeyConfig}:{nKey}:ProjListAll";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);