fix ricerca valori in cache redis...

This commit is contained in:
Samuele E. Locatelli
2018-12-05 23:18:23 +01:00
parent 66af33181f
commit 9b672839cc
2 changed files with 69 additions and 14 deletions
Vendored
+1 -1
View File
@@ -10,7 +10,7 @@ pipeline {
steps {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=640']) {
withEnv(['NEXT_BUILD_NUMBER=641']) {
// env.versionNumber = VersionNumber(versionNumberString : '3.2.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '3.2.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'SteamWareLib'
+68 -13
View File
@@ -144,7 +144,8 @@ namespace SteamWare
{
try
{
if (redHashPresent(ACBH))
if (redKeyPresent(ACBH))
//if (redHashPresent(ACBH))
{
AppConf = new Dictionary<string, string>();
foreach (var item in redGetHash(ACBH))
@@ -226,9 +227,13 @@ namespace SteamWare
DateTime answ = DateTime.Now.AddDays(-1);
try
{
answ = Convert.ToDateTime(objCacheObj("lastUpdateAppConf"));
// se è in cache
if (isInCacheObject("lastUpdateAppConf"))
{
answ = Convert.ToDateTime(objCacheObj("lastUpdateAppConf"));
}
}
catch(Exception exc)
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore recupero lastUpdateAppConf{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
}
@@ -848,7 +853,7 @@ namespace SteamWare
}
/// <summary>
/// restituisce true se presente in session l'oggetto richiesto
/// restituisce true se sia presente in session l'oggetto richiesto
/// </summary>
/// <param name="nomeVar"></param>
/// <returns></returns>
@@ -1148,7 +1153,7 @@ namespace SteamWare
}
/// <summary>
/// restituisce true se presente in cache l'oggetto richiesto
/// restituisce true se sia presente in cache l'oggetto richiesto
/// </summary>
/// <param name="nomeVar"></param>
/// <returns></returns>
@@ -1158,13 +1163,25 @@ namespace SteamWare
bool stringAnsw = false;
if (cacheOnRedis)
{
// cerco come hash...
answ = redHashPresent(redHash(nomeVar));
// cerco come variabile se NON trovata...
if (!answ)
try
{
var redVal = getRSV(redHash(nomeVar));
answ = redVal != null && redVal != "";
// cerco come key...
answ = redKeyPresent(redHash(nomeVar));
if (!answ)
{
// cerco come hash...
answ = redHashPresent(redHash(nomeVar));
}
// cerco come variabile se NON trovata...
if (!answ)
{
var redVal = getRSV(redHash(nomeVar));
answ = redVal != null && redVal != "";
}
}
catch(Exception exc)
{
logger.lg.scriviLog(string.Format("Errore in verifica isInCacheObject REDIS per chiave{0}{1}{2}", nomeVar, Environment.NewLine, exc));
}
}
else
@@ -1181,8 +1198,10 @@ namespace SteamWare
{
answ = (HttpContext.Current.Cache[nomeVar] != null && stringAnsw);
}
catch
{ }
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore in verifica isInCacheObject per chiave{0}{1}{2}", nomeVar, Environment.NewLine, exc));
}
}
return answ;
}
@@ -1644,6 +1663,42 @@ namespace SteamWare
return answ;
}
/// <summary>
/// Verifica se ci siano valori nella KEY indicata...
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public bool redKeyPresent(RedisKey key)
{
bool answ = false;
// cerco se ci sia valore in redis...
try
{
answ = cache.KeyExists(key);
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore in redKeyPresent per la key {2}:{0}{1}", Environment.NewLine, exc, key), tipoLog.EXCEPTION);
}
return answ;
}
/// <summary>
/// Verifica se ci siano valori nella KEY indicata (string)
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public bool redKeyPresentSz(string key)
{
bool answ = false;
try
{
RedisKey chiave = key;
answ = redKeyPresent(chiave);
}
catch
{ }
return answ;
}
/// <summary>
/// Verifica se ci siano valori nella hash indicata...
/// </summary>
/// <param name="key"></param>